Problem/Motivation

When serving a Shorthand story that's been downloaded to a Drupal site via the Shorthand API, some story assets are loaded over http and not https.

Sample console error: "Mixed Content: The page at 'https://website.org/node/99' was loaded over HTTPS, but requested an insecure script 'http://website.org/sites/default/files/shorthand/stories/busgTbaaXq/2025...'"

Steps to reproduce

After installing and configuring the Shorthand module, download a story to your Drupal site. Create a node that features that Shorthand story, then publish. Upon viewing the published node, the Shorthand story will load incorrectly with broken images and JS assets.

I then created the following patch to force https, unfortunately to no avail:

--- web/modules/contrib/shorthand/src/Entity/ShorthandStory.php	2025-02-19 17:14:24
 +++ web/modules/contrib/shorthand/src/Entity/ShorthandStoryPatched.php	2025-02-19 17:14:34
 @@ -520,6 +520,7 @@
      }
      $content = str_replace('./static/', $assets_path . '/static/', $content);
      $content = preg_replace('/.(\/theme-\w+.min.css)/', $assets_path . '$1', $content);
 +    $content = str_replace('http://','https://',$content);
  
      return $content;
    }

Any guidance or suggestions are be appreciated. Thanks in advance!

Issue fork shorthand-3513527

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ninabyte created an issue. See original summary.

vladimiraus’s picture

Version: 4.0.19 » 4.0.x-dev
Status: Active » Needs work

vladimiraus’s picture

Status: Needs work » Needs review
jannakha’s picture

Status: Needs review » Reviewed & tested by the community

code tested, fix works

vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Thank you. Committed. 🍻

  • vladimiraus committed 9c736368 on 4.0.x
    Issue #3513527 by vladimiraus, ninabyte, jannakha: Mixed content error...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.