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 page seeds fails if any attached file path contains a white space character #836

Closed
morgant opened this issue Jul 23, 2018 · 2 comments

Comments

@morgant
Copy link
Contributor

morgant commented Jul 23, 2018

Expected behavior

Running the comfy:cms_seeds:import rake task (e.g. rails 'comfy:cms_seeds:import[site-identifier]' should import all the seed layout, pages, files, etc., including any file that has correctly escaped special characters (incl. white space).

Actual behavior

If a page seed has an attached file path containing white space characters (esp. space), whether the special characters are escaped or not, it will fail with a Errno::ENOENT: No such file or directory @ rb_sysopen.

Steps to reproduce

If you have a db/cms_seeds/site-name/pages/some-page/content.html seed file that includes an attached file, for example:

[file slide_image]
file\ name.jpg

If the attached file exists, attempt to import it by running rails 'comfy:cms_seeds:import[site-name]', you'll get the following error:

Errno::ENOENT: No such file or directory @ rb_sysopen - /path/to/project/db/cms_seeds/site-name/pages/some-page/file

Note the file path is truncated at the white space character.

System configuration

Rails version: 5.2.0

CMS version: 2.0.16

Ruby version: 2.5.1p57

@morgant morgant changed the title Importing page seeds fails if any attached filename contains a white space character Importing page seeds fails if any attached file path contains a white space character Jul 23, 2018
@morgant
Copy link
Contributor Author

morgant commented Jul 23, 2018

I believe that frag_content.split.collect should be frag_content.split("\n").collect in lib/comfortable_mexican_sofa/seeds/page/importer.rb:190. Will test & submit a PR.

morgant added a commit to morgant/comfortable-mexican-sofa that referenced this issue Jul 25, 2018
morgant added a commit to morgant/comfortable-mexican-sofa that referenced this issue Jul 27, 2018
GBH pushed a commit that referenced this issue Aug 5, 2018
…haracters (#837)

* Fix errors when importing page seed with attached file path containing whitespace characters. Issue #836

* Update seed data & test to fail prior to fix for Issue #836
@GBH
Copy link
Member

GBH commented Aug 7, 2018

Fixed in #837

@GBH GBH closed this as completed Aug 7, 2018
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

2 participants