Files
mattermost/utils
Jesse Hallam cd5d5f832c MM-14052: fix subpath yet again (#10278)
* MM-14052: fix subpath yet again

The server now emits a script-src directive that overrides the root.html
rewrite. Fix this by emitting the requisite sha-256 hash server-side as
well as rewriting root.html. We can't remove the root.html rewrite,
since the assets may be on a CDN instead and we use the same code path
to rewrite them (on demand).

Prior to this change, going from / -> /subpath -> / would leave changes
in root.html: the Content-Security-Policy header would still have the
sha-256 hash, and the inline script would still override the publicPath
but to the default subpath value. To avoid sending down a sha-256 hash
server-side when no subpath is required, change this to fully strip out
the subpath changes. This is the only unit test change, as the existing
coverage proves the algorithm still works.

* fix subpath concatenation in test

path.Join isn't meant to work with a URL + path, and my test was effectively working with the subpath "/localhost:8065/subpath" instead of just "/subpath". The CI servers presumably caught this due to a different configuration than my local development.
2019-02-13 11:30:02 -04:00
..
2018-06-21 11:31:51 -07:00
2017-10-30 11:57:24 -05:00
2017-10-30 11:57:24 -05:00
2019-01-10 15:17:31 -05:00
2019-02-12 08:37:54 -05:00
2017-09-06 23:11:59 -07:00