Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Our approach to downloadable URLs is to have the absolute path to the image, so the consumer can fill in the rest. This is not the desired approach, nor the approach taken by Consumer Image Styles.
Proposed resolution
Use the fully resolvable URL in the returned object.
API changes
The url
property on files now contains the full download URL.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2929600--use-full-url-file--2.patch | 1.48 KB | e0ipso |
|
Comments
Comment #2
e0ipsoI realize this breaks BC, but I wanted to start the discussion.
Comment #3
Wim LeersWhy is this not desired?
Then why shouldn't Consumer Image Styles update its approach?
Comment #4
e0ipsoI created this issue merely to allow people to turn this feature on easily. This is just a convenient way to host a patch.
Comment #5
Wim LeersOkay.
I disagree with the use of a FQDN. If you want that though, then you should chime in on #2825487: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field soon!
Comment #6
e0ipsoOh! I'll read more on this tomorrow.
Comment #7
Wim Leers👍
Comment #8
e0ipsoCan you link to the specific comment that has the reasoning you're highlighting in #5?
Comment #9
Wim LeersSee #2825487-12: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field.4 + #2825487-109: Fix normalization of File entities: file entities should expose the file URL as a computed property on the 'uri' base field.
All of Drupal core has been switching to root-relative file URLs, see #1494670: References to CSS, JS, and similar files should be root-relative URLs: avoids mixed content warnings & fewer bytes to send and #2099205: When uploading and inserting an image trough the WYSIWYG plugin a relative path should be used for the image source (src) .
Comment #10
Wim LeersMarking postponed, so that people don't think this patch needs a review.
Comment #11
e0ipsoGood call. Thanks.
Comment #12
Wim LeersThe upcoming 2.x branch of JSON API will be able to drop this work-around, because Drupal 8.5 core fixed the problem in core! i.e. once #2926463: [>=8.5] Remove JSON API's "file URL" field work-around now that Drupal core 8.5 fixed it lands in the 2.x branch (once the 2.x branch actively branches off from the 1.x branch), this will no longer be relevant.