Commit Graph

10 Commits

Author SHA1 Message Date
Renovate Bot
ec7805b7f0 Pin dependency c8 to 7.7.3 2021-06-17 13:57:17 +00:00
Hannah Wolfe
d259fcc4c6 Published new versions
- @tryghost/config-url-helpers@0.1.0
2021-06-17 14:55:21 +01:00
Hannah Wolfe
5b43d82742 Improved types in config-url-helpers 2021-06-17 13:53:09 +01:00
Hannah Wolfe
eb829a050b Prepared config-url-helpers for their intended use
- added getSubdir, getSiteUrl and getAdminUrl methods from url-utils
- refactored them so they are designed to be bound by nconf
- exposed a bindAll method
- moved over the tests and refactor from a class instance to nconf bindings
2021-06-17 11:41:50 +01:00
Sam Lord
320e689ad4 Published new versions
- @tryghost/adapter-manager@0.2.14
 - @tryghost/config-url-helpers@0.0.1
 - @tryghost/errors@0.2.13
 - @tryghost/image-transform@1.0.13
 - @tryghost/moleculer-service-from-class@0.2.17
 - @tryghost/mw-session-from-token@0.1.22
 - @tryghost/package-json@1.0.2
 - @tryghost/session-service@0.1.24
 - @tryghost/tpl@0.1.3
2021-06-17 10:50:39 +01:00
Hannah Wolfe
3927c9002c Fixed merge error for deduplicate subdirectory
- tried to move history and fucked up git filter-repo :(
2021-06-16 20:22:06 +01:00
Hannah Wolfe
f98bcf150c Merged deduplicate subdirectory util from SDK/url-utils 2021-06-16 17:55:14 +01:00
Hannah Wolfe
0d965276a1 Added new config-url-helpers package
- This will contain a small number of helpers for getting correctly formatted urls from config
2021-06-16 17:54:30 +01:00
Kevin Ansfield
523278b295 🐛 Fixed subdirectory handling and deduplication
no issue

Ghost's relative->absolute handling is a little strange when the rootUrl includes a subdirectory. Root-relative paths such as /content/image.jpg are actually treated as subdirectory-relative. This means that it's possible to migrate from a root config to a subdirectory config without migrating data in the database, _however_ that means that the database will now have a mix of path styles (/content/image.png and /subdir/content/image.png). To handle this when all root-relative paths are treated as subdir-relative we have to rely on subdirectory deduplication.

- updates tests to reflect correct subdirectory handling according to the above rules
- fixes missing subdirectories when root urls contain subdirectories but relative paths do not
- fixes subdirectory deduplication when the supplied url/path does not have a trailing slash but matches the root url's subdirectory
2019-10-02 12:33:34 +01:00
Kevin Ansfield
86343f028b Refactored url-utils (#141)
no issue

- extracted most standalone util functions into separate files+tests
- switched the main `UrlUtils` function into a class (we had mixed uses of the returned object previously as both `urlUtils()` and `new UrlUtils()` - the class makes it obvious that the `new` keyword is required)
- removed some unnecessary use of lodash and switched to using `URL` in place of `url` so that the package can have parity across node+browser without needing an additional package bundled in
2019-08-12 08:57:13 +01:00