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

Escape special characters in beer name #29

Open
elcojacobs opened this issue Mar 28, 2014 · 1 comment
Open

Escape special characters in beer name #29

elcojacobs opened this issue Mar 28, 2014 · 1 comment

Comments

@elcojacobs
Copy link
Member

Script crashes when slashes or # is used in the beer name.

@vanosg
Copy link
Collaborator

vanosg commented Jul 11, 2014

Elco, I did a little more research on this-

The issue, on *nix atleast, is only the / and \0 characters (the only non-allowed characters in a file path, which is the error being generated). When the script tries to write the beer name My/Beer, BrewPi uses the name as part of the filename /the/path/to/My/Beer - you can see how BrewPi then gets confused:
named used: a/b\c#d
IOError: [Errno 2] No such file or directory: '/home/brewpi/data/a/b\c#d/a/b\c#d-2014-07-10.json'

and \ are fine as far as I can tell (and research suggests they should be):

Jul 10 2014 20:57:06 Notification: Restarted logging for beer 'omg###'.
Jul 10 2014 20:57:53 Notification: Restarted logging for beer 'omg\kk'.
No errors. ^^^

I'm patching to simply replace the / with a _ . It is not possible to escape a / in a filepath in *nix. The PR is on its way

Note: When it comes to Windows, there's TONS of disallowed chars, and even combos of chars, and would probably need a re-write of how we store data files to properly address that. For now, adding a note in the docs (or on the UI) is likely the best use of time.

vanosg pushed a commit to vanosg/brewpi-script that referenced this issue Jul 11, 2014
Issue BrewPi#29
We use the beer name as part of the file path for saving data... no problems there if we use MyBeer as a name,
the path is /path/to/MyBeer . However, if we use My/Beer as the name, the filepath becomes /path/to/My/Beer and
breaks everything. We simply replace / with _ to avoid this problem. Note- Windows has a TON of restricted chars
and COMBOS of chars that are restricted, but not addressed in this patch.
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