Skip to content

Commit

Permalink
Merge pull request #9 from markhuot/version-matrix
Browse files Browse the repository at this point in the history
fixes a bug where URI is not computed correctly on 4.6.x
  • Loading branch information
markhuot authored Dec 12, 2023
2 parents fa280c8 + 6778bec commit 6001d8b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
version: [~4.5.0, ~4.6.0]

env:
CRAFT_APP_ID: pest
CRAFT_ENVIRONMENT: dev
Expand All @@ -39,11 +43,11 @@ jobs:
MYSQL_DATABASE: pest
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 5
#options: >-
# --health-cmd "mysqladmin ping --silent"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5

steps:
- uses: actions/checkout@v3
Expand All @@ -62,7 +66,7 @@ jobs:

- name: Install dependencies
run: |
composer install --prefer-dist --no-progress
composer require "craftcms/cms:${{ matrix.version }}" --prefer-dist --no-progress
./bin/post-clone.sh
- name: Copy config files
Expand All @@ -71,6 +75,9 @@ jobs:
cp -r ./stubs/config ./
cat config/app.php
- name: Wait for MySQL
run: until mysqladmin ping -h 127.0.0.1 -u root -proot; do sleep 1; done

- name: Install Craft
run: php craft install --interactive=0 --username=admin [email protected] --password=secret --siteName=Pest --siteUrl=http://localhost:8080 --language=en-US

Expand All @@ -81,4 +88,4 @@ jobs:
run: ./vendor/bin/pint --test src/

- name: Run test suite
run: ./vendor/bin/pest
run: ./vendor/bin/pest --compact -vvv
5 changes: 4 additions & 1 deletion src/http/requests/WebRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ public function setDefaultProperties(string $url)

$pathParam = \Craft::$app->config->general->pathParam ?? 'p';
$omitScriptNameInUrls = \Craft::$app->config->general->omitScriptNameInUrls;
if ($omitScriptNameInUrls === false && ($queryParams[$pathParam] ?? false)) {
if (in_array($omitScriptNameInUrls, [true, null], true) && ($queryParams[$pathParam] ?? false)) {
$uri = $queryParams[$pathParam];
unset($queryParams[$pathParam]);
}
if ($omitScriptNameInUrls === false) {
$uri = $queryParams[$pathParam] ?? $uri;
}

$isCpRequest = $this->uriContainsAdminSlug($uri);
if ($isCpRequest) {
Expand Down

0 comments on commit 6001d8b

Please sign in to comment.