Skip to content

Commit

Permalink
replace / with _ in beer names
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Geo Van Osterom committed Jul 11, 2014
1 parent 33f21be commit 6da41ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion brewpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def renameTempKey(key):
logMessage("Notification: Interval changed to " +
str(newInterval) + " seconds")
elif messageType == "startNewBrew": # new beer name
newName = value
newName = value.replace("/","_") # name is used as part of file path, *nix can't handle /s in filenames
result = startNewBrew(newName)
conn.send(json.dumps(result))
elif messageType == "pauseLogging":
Expand Down

0 comments on commit 6da41ef

Please sign in to comment.