8000 guard against misconfiguration of fileHost setting by ansuz · Pull Request #2017 · cryptpad/cryptpad · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@ansuz
Copy link
Contributor
@ansuz ansuz commented Aug 2, 2025

In the process of tinkering with my CryptPad instance I discovered that accidentally including a trailing slash for the fileHost setting in config/config.js breaks blocks and blobs.

The reason is that there are a bunch of points in the code where if fileHost is present it will be directly prepended to those resources' file paths. When it is set to https://files.myinstance.website/ rather than https://files.myinstance.website, this doubles up on the leading slash, and lots of things break.

This patch modifies the server to convert fileHost to the expected format if it is present, and to do nothing otherwise. I suppose it could break some non-standard uses of the value, such as if files are loaded from a subpath of another domain, but as far as I know that isn't supported behaviour.

Feel free to reject this PR in any case, but I figured it might save someone else the time I spent debugging the issue after my silly mistake.

@yflory yflory added this to the Autumn Release (2025.9.0) milestone Aug 4, 2025
@yflory yflory merged commit d04939a into cryptpad:staging Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0