Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing zip file fails because of a hidden implementation detail #18

Open
muratcorlu opened this issue Apr 12, 2024 · 0 comments
Open

Comments

@muratcorlu
Copy link
Contributor

I tried to import images of a website by making them zip file and import with Ghost admin's import section. But this request failed with the error below:

Cannot read properties of undefined (reading 'split'): An unexpected error occurred, please try again.
  File "/var/lib/ghost/versions/5.82.1/node_modules/@tryghost/mw-error-handler/lib/mw-error-handler.js", line 102, col 19, in module.exports.prepareError
    err = new errors.InternalServerError({
  File "/var/lib/ghost/versions/5.82.1/core/server/data/importer/handlers/image.js", line 18, col 68, in Object.loadFile
    const imageFolderRegexes = _.map(store.staticFileURLPrefix.split('/'), function (dir) {
  File "/var/lib/ghost/versions/5.82.1/core/server/data/importer/import-manager.js", line 318, col 44, in ImportManager.processZip
    const data = await handler.loadFile(files, baseDir);
  File "/var/lib/ghost/versions/5.82.1/core/server/data/importer/import-manager.js", line 491, col 26, in ImportManager.importFromFile
    importData = await this.loadFile(file);
  File "/var/lib/ghost/versions/5.82.1/node_modules/@tryghost/api-framework/lib/pipeline.js", line 259, col 34, in getResponse
    const response = await STAGES.query(apiUtils, apiConfig, apiImpl, frame);
  File "/var/lib/ghost/versions/5.82.1/node_modules/@tryghost/api-framework/lib/pipeline.js", line 264, col 30, in wrapper
    const response = await getResponse();
  File "/var/lib/ghost/versions/5.82.1/node_modules/@tryghost/api-framework/lib/http.js", line 64, col 28, in Http
    const result = await apiImpl(frame);

Apparently it expects a staticFileURLPrefix property of storage adapter, which is not documented in Ghost docs at all.

This is reported with an issue here: TryGhost/Ghost#16530 But apparently it's ignored. I asked this in Ghost Forum as well: https://forum.ghost.org/t/custom-storage-adapter-documentation-is-incomplete/46499

I quickly tried to add this property by setting it to pathPrefix but it didn't work. If I'll have more time, I'll check more deeply. But I wanted to open this issue to make this visible anyway.

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

No branches or pull requests

1 participant