mjml-app icon indicating copy to clipboard operation
mjml-app copied to clipboard

Can't open projects or create files with plus or ampersand character(s) in the path

Open outdooracorn opened this issue 5 years ago • 3 comments

Describe the bug

When creating or opening a project that contains a "special" character nothing is shown. Trying to create a new file in the project displays the error: Error creating file. The interesting thing is that it is able to create and delete projects with a special character in the path, just not open them.

I had a plus (+) character in the path and it looks like issue #225 had the same problem with an ampersand (&) character. I say "special" as plus (+) and ampersand (&) don't work but other special characters, e.g. a dash (-), do. These are both valid characters in a path on Linux, Windows and OSX.

The developer console shows this error which seems pertinent:

index.html#/project?path=D:\SB\Swanbarton Limited\SB - 2755 IFBF 2020\Website + Eventbee\Custom Order Emails\IFBF 2020 MJML Templates:
1 Uncaught (in promise) Error: ENOENT: no such file or directory, scandir 'D:\SB\Swanbarton Limited\SB - 2755 IFBF 2020\Website   Eventbee\Custom Order Emails\IFBF 2020 MJML Templates'

It shows that the plus (+) character has been replaces with a space which of cause results in a no such file or directory error.

To Reproduce

Steps to reproduce the behavior:

  1. Open MJML App on Windows 10
  2. Click on 'New project'
  3. Enter a project name with a special character (e.g. "Test+Project")
  4. Click on 'Choose template'
  5. Click on 'Create'
  6. See app with no contents
  7. Click on 'New file'
  8. Enter a new file name (e.g. "newfile")
  9. Click on 'Create file'
  10. See error Error creating file
  11. Click on 'View -> Toggle Developer Tools'
  12. Click on the 'Console' tab
  13. See error beginning with Uncaught (in promise) Error: ENOENT: no such file or directory,

Expected behavior

As a new user, I expected to see some content when creating a new project, not a blank area. When I create a new file I expect the file to be created, not a nondescript error.

When creating a new project, it shouldn't say Location is OK if, in fact, it is not.
When creating a new file, it shouldn't say Ready to create <filename>.mjml if, in fact, it is not.

Screenshots

image image

Environment

  • OS: Windows 10
    • Version: 1809
    • OS Build: 17763.864
  • App Version: v2.12.0

outdooracorn avatar Nov 27 '19 16:11 outdooracorn

A quick test (on Windows) shows that grave (`) exclamation mark (!), pound (£), dollar ($), caret (^) open bracket ((), close bracket ()), dash (-), underscore (_), open curly bracket ({), close curly bracket (}), open square bracket ([), close square bracket (]), tilde (~), at (@), semi-colon (;), comma (,) and full stop (.) all work when creating a project.

Hash (#) behaves the same as plus (+) and ampersand (&) in that it creates the project but can't open it.

Percent (%) pops up the following error and fails to create the project:

    at decodeURIComponent (<anonymous>)
    at C:\Program Files\MJML\resources\app.asar\node_modules\query-string\index.js:147:36
    at Array.forEach (<anonymous>)
    at exports.parse (C:\Program Files\MJML\resources\app.asar\node_modules\query-string\index.js:138:17)
    at decodeQuery (C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\useQueries.js:45:52)
    at C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\useQueries.js:75:25
    at C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\useBasename.js:67:16
    at C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\createHistory.js:55:14
    at Array.forEach (<anonymous>)
    at updateLocation (C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\createHistory.js:54:15)
    at C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\createHistory.js:119:56
    at C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\createHistory.js:90:9
    at next (C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\AsyncUtils.js:51:7)
    at loopAsync (C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\AsyncUtils.js:55:3)
    at confirmTransitionTo (C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\createHistory.js:80:31)
    at transitionTo (C:\Program Files\MJML\resources\app.asar\node_modules\history\lib\createHistory.js:100:5)

Colon (:), question mark (?) and asterisk (*) show the error ENOENT No such file or directory, mkdir <filepath> as you would probably expect given that they are reserved characters

outdooracorn avatar Nov 27 '19 16:11 outdooracorn

Percent sign "%" is not working on Mac OSX as Project Name

URIError: URI malformed at decodeURIComponent () at /Applications/MJML.app/Contents/Resources/app.asar/node_modules/query-string/index.js:147:36 at Array.forEach () at exports.parse (/Applications/MJML.app/Contents/Resources/app.asar/node_modules/query-string/index.js:138:17) at decodeQuery (/Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/useQueries.js:45:52) at /Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/useQueries.js:75:25 at /Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/useBasename.js:67:16 at /Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/createHistory.js:55:14 at Array.forEach () at updateLocation (/Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/createHistory.js:54:15) at /Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/createHistory.js:119:56 at /Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/createHistory.js:90:9 at next (/Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/AsyncUtils.js:51:7) at loopAsync (/Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/AsyncUtils.js:55:3) at confirmTransitionTo (/Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/createHistory.js:80:31) at transitionTo (/Applications/MJML.app/Contents/Resources/app.asar/node_modules/history/lib/createHistory.js:100:5)

benjamin74 avatar Sep 10 '20 11:09 benjamin74

should be fixed by https://github.com/mjmlio/mjml-app/pull/363, the release will come soon

kmcb777 avatar Jan 06 '22 16:01 kmcb777