Skip to content

Commit

Permalink
Merge pull request #52 from Laravel-Backpack/fix-query-strings
Browse files Browse the repository at this point in the history
Fixed loading of assets with query strings
  • Loading branch information
tabacitu authored Jun 24, 2023
2 parents 6414c1c + 638f26f commit 3baed54
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/BassetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public function echoJs(string $path, array $attributes = []): void
public function getPath(string $asset): string
{
return Str::of($this->basePath)
->append(str_replace([base_path(), 'http://', 'https://', '://', '<', '>', ':', '"', '|', '?', "\0", '*', '`', ';', "'", '+'], '', $asset))
->append(str_replace([base_path(), 'http://', 'https://', '://', '<', '>', ':', '"', '|', "\0", '*', '`', ';', "'", '+'], '', $asset))
->before('?')
->replace('/\\', '/');
}

Expand Down Expand Up @@ -243,6 +244,12 @@ public function basset(string $asset, bool|string $output = true, array $attribu

$content = Http::get($asset)->body();
} else {
// clean local asset
$asset = Str::before($asset, '?');

if (! File::exists($asset)) {
return $this->loader->finish(StatusEnum::INVALID);
}
$content = File::get($asset);
}

Expand Down

0 comments on commit 3baed54

Please sign in to comment.