From 80b1c331b3855180cbae4e9f8e21ac3817cbb0c7 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 4 Jun 2020 23:27:14 +0300 Subject: [PATCH] Fixed broken `file` field preview when using streams in the path --- CHANGELOG.md | 3 ++- themes/grav/templates/forms/fields/file/file.html.twig | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14daf67c..d77e506c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ * Added new `onAdminListContentEditors` event to add a custom editor to the list of available 1. [](#bugfix) * Use `Pages::find()` instead of `Pages::dispatch()` as we do not want to redirect out of admin - * Fixed broken `parent` field when using the old pages + * Fixed broken `parent` field when using the old pages + * Fixed broken `file` field preview when using streams in the path # v1.10.0-rc.11 ## 05/14/2020 diff --git a/themes/grav/templates/forms/fields/file/file.html.twig b/themes/grav/templates/forms/fields/file/file.html.twig index ccc3953c..f86f3b0f 100644 --- a/themes/grav/templates/forms/fields/file/file.html.twig +++ b/themes/grav/templates/forms/fields/file/file.html.twig @@ -35,7 +35,7 @@ {% set blueprint_name = type ~ '/' ~ blueprint_name %} {% endif %} {% set blueprint = base64_encode(blueprint_name) %} - {% set real_path = value.thumb ?? global.context.media[path].relativePath ?? global.form.getPagePathFromToken(path) ?? global.admin.getPagePathFromToken(path) %} + {% set real_path = (value.thumb ?? global.context.media[path].relativePath ?? global.form.getPagePathFromToken(path) ?? global.admin.getPagePathFromToken(path))|ltrim('/') %} {% set remove = global.file_task_remove ? global.file_url_remove : uri.addNonce( global.file_url_remove ~