Problem/Motivation

#1494670: References to CSS, JS, and similar files should be root-relative URLs: avoids mixed content warnings & fewer bytes to send solved the problems with using absolute file URLs by using root-relative file URLs instead.

In doing so, it broke an edge case: where file URLs are generated inside the theme/render system (intended for HTML to be served over HTTP) but the resulting HTML is not served using HTTP, but instead:

  • sent in e-mails
  • emitted as part of RSS

Proposed resolution

Allow file_create_url($uri) to accept an optional file_create_url($uri, $absolute = FALSE) parameter, which can be set to TRUE.

Remaining tasks

None.

User interface changes

None.

API changes

New optional parameter.

Data model changes

None.

CommentFileSizeAuthor
#2 ability_to_generate-2669040-2.patch1.81 KBcilefen

Comments

Wim Leers created an issue. See original summary.

cilefen’s picture

Status: Active » Needs review
StatusFileSize
new1.81 KB

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

berdir’s picture

@Wim I think we can close this issue. file_create_url() is being moved to a service with a $relative argument that however has a different meaning and the RSS & E-Mail (finally) use cases have been dealt with.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

berdir’s picture

Status: Needs review » Closed (duplicate)

Nobody objected, so closing as a duplicate of #2669074: Convert file_create_url() & file_url_transform_relative() to service, deprecate it and other issues that dealt with feeds/e-mails.