openzim/zimfarm

Slash in schedule/recipe name is causing issues

Opened this issue · 4 comments

  • Location: API

Problem

When we put a slash / in a recipe name, this seems to be saved to the database properly but afterwards we cannot open the recipe anymore in the UI:

image

What is fun (or not) is that even the preflight OPTIONS request end-up with a 404, while when we just input a wrong recipe name the OPTIONS end-up with a 200 and the GET with a 404

I think that we should probably forbid unusual characters in recipe names at creation / edition. alphanums + underscore is probably enough ; I would even forbid dash to avoid confusion between underscores and dashes.

The other solution (allow mostly any chars) is probably way more complex / not very useful.

Keep in mind that we start the recipe name with domain name for which dash - are allowed

Good point, dots as well I imagine 🤣 (and probably other chars)

There is no other characters allowed in domain names, so I would change my mind:

  • allow lower-case letters (only), no upper-case letters (to avoid duplicates changing only casing, just like in domain names)
  • allow ., - (both are present in domain names) and _ (used a lot in our naming conventions)
  • allow digits

Is it better?

Yes it's probably enough. Domain names can be almost anything now and that will be reflected in Name metadata but zimfarm could use an approximation for the 1% that actually use extended characters.
This should probably be discussed in a content meeting. What's the current way of doing with websites that are in non-ASCII charset like Arabic or Chinese?