Skip to content

Commit

Permalink
Merge pull request #13223 from craftcms/dont-assume-url
Browse files Browse the repository at this point in the history
Dont assume url
  • Loading branch information
brandonkelly authored May 26, 2023
2 parents fa130b5 + cb712c4 commit de601d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes for Craft CMS 4

## Unreleased

- Fixed a JavaScript error that could occur when renaming assets without URLs. ([#13223](https://github.com/craftcms/cms/pull/13223))

## 4.4.13 - 2023-05-24

- Fixed a bug where asset sources weren‘t immediately showing a source path on a clear `localStorage` cache.
Expand Down
1 change: 1 addition & 0 deletions src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2950,6 +2950,7 @@ protected function htmlAttributes(string $context): array
'data' => [
'kind' => $this->kind,
'alt' => $this->alt,
'filename' => $this->filename,
],
];

Expand Down
6 changes: 1 addition & 5 deletions src/elements/actions/RenameFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ public function getTriggerHtml(): ?string
activate: \$selectedItems => {
const \$element = \$selectedItems.find('.element')
const assetId = \$element.data('id');
let oldName = \$element.data('url').split('/').pop();
if (oldName.indexOf('?') !== -1) {
oldName = oldName.split('?').shift();
}
let oldName = \$element.data('filename');
const newName = prompt($prompt, oldName);
Expand Down

0 comments on commit de601d8

Please sign in to comment.