Skip to content

Commit

Permalink
Fixed preview link for non-images files in Pagemedia (fixes #1727, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
w00fz committed Aug 21, 2019
1 parent 1ac925b commit faac66c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
## mm/dd/2019

1. [](#bugfix)
* Fixed regression with files in admin not allowing types other than images
* Fixed regression with files in admin not allowing types other than images [#1737](https://github.com/getgrav/grav-plugin-admin/issues/1737)
* Fixed preview link for non-images files in Pagemedia [#1727](https://github.com/getgrav/grav-plugin-admin/issues/1727)

# v1.9.8
## 08/11/2019
Expand Down
4 changes: 3 additions & 1 deletion themes/grav/app/pages/page/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ export default class PageMedia extends FilesField {
let file = target.parent('.dz-preview').find('.dz-filename');
let filename = encodeURI(file.text());
let URL = target.closest('[data-media-path]').data('media-path');
let original = this.dropzone.files.filter((file) => encodeURIComponent(file.name) === filename).shift().extras.original;
let original = this.dropzone.files.filter((file) => encodeURIComponent(file.name) === filename).shift();

original = original.extras.original || encodeURIComponent(original.name);

target.attr('href', `${URL}/${original}`);
});
Expand Down
Loading

0 comments on commit faac66c

Please sign in to comment.