Closed rampantoctopus closed 3 years ago
Ah yup this is only an issue if the IBU or ABV contains a decimal... I messed that up yesterday in adding the edit recipe experience for ya. Sorry bout that!
File "/<>/picobrew_pico/app/main/routes_frontend.py", line 390, in update_pico_recipe
recipe.update_recipe(filename, update_recipe)
File "/<>/picobrew_pico/app/main/recipe_parser.py", line 321, in update_recipe
self.abv = int(recipe.get('abv', self.abv))
ValueError: invalid literal for int() with base 10: '6.6'
Though not sure why the download isn't working for you, I've been able to reliably get that to work here.
When opening devtools do you see any warnings or errors?
https://github.com/chiefwigms/picobrew_pico/pull/213 should resolve that issue with the save
Though not sure why the download isn't working for you, I've been able to reliably get that to work here.
When opening devtools do you see any warnings or errors?
Ok, that's interesting-- the download button works for other files, but specifically the download on Annie's London Ale doesn't work-- I've tried a bunch of other .json files both with and without making changes to the comments field, both with and without graphics and it's just Annie's... really bad luck?
When working with Annie's London Ale: Download button causes: SyntaxError: Unexpected identifier 's'. Expected ')' to end an argument list. Save button causes: [Error] Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR) (update_pico_recipe, line 0)
Ah yeah... that ' (single quote) is breaking out of the container and causing a problem... we don't do a great job at validating user input cause the worst damage you do is screw up your local hardware there is no "centralized server to hack".
here is the offending javascript/html
<button class="btn btn-sm btn-primary float-right mr-5" type="button" id="bdownload_182c5e16713041" onclick="event.stopPropagation();event.preventDefault();download_recipe('182c5e16713041', 'Annie's Ale');">
<i class="fas fa-download"></i>
</button>
to make it more clear
'Annie's Ale'
Is it just the .json file name or is the title inside the .json file also a problem? If it's just the file name, I could rename the five or so recipes in the library that cross the line:
"Mowin' Time," "Annie's London," "Brew_Free!_or_Die_IPA," "Pike_Monk's_Uncle_Tripel," and "Poçao_da_Lua_Cheia," "Blank_Slate_Distiller's_Pak"
not sure if a periods are also a problem: "Pt._Bonita_Bohemian_Pils" "Mt._Baker_Maibock"
Nah periods are or should be fine. Also the quotes in all honesty should be fine too, what would be problematic later (and cause invalid session files...) is a "#".
I'll look at escaping the "user input" in our django template which I thought was doing that by default, but apparently not.
This is fixed now
It appears that the save and download buttons in the Pico recipes have been broken -- download now opens and collapses the recipe details (and doesn't not download the .json file) and the save button doesn't seem to do anything.