-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[WIP] Make Commons filename editable #56
base: main
Are you sure you want to change the base?
Conversation
I think we should probably add an API call to validate any new filename, because otherwise it'll be annoying not just for filenames with special characters (we could solve that with a Also, maybe the filename field should be removed from the first screen entirely? i.e. first just ask for an IA ID and target filetype, and then on the next page ask for the filename? Would be simpler for the user, I think. |
Sounds sensible. Is there an API call for "this filename would be A-OK to upload" (would be useful for my own nefarious purposes). I'd certainly support removing the title from the first page - in 99% of the cases I use it for, I take the title from the IA page anyway, so I have to open the IA page and switch tabs a few times. And even if you have a title on the clipboard, there's no harm in waiting for the next page to enter it. |
This makes the Commons name an optional field. If not given, a name is constructed from the IA metadata, if possible. It can still be entered via the query parameter on /fill, so it's possible to preload a custom name (e.g. via a template on-wiki)
OK, so here's a new approach which adds quite a bit of IA metadata munging logic to construct a name. Then it removes the filename field from the front page and auto-generates one for you. You can still set the name via the query parameter so it doesn't restrict the ability to set a name with the URL (e.g. from a template or something on-wiki). Still needs a way to validate the name - is there an easy MW API to do that, or could it be just done in JS with (length < 240 && !contains(':')? Also should check for existing files with that name. |
Il 15/07/21 19:16, inductiveload ha scritto:
Still needs a way to validate the name - is there an easy MW API to do that, or could it be just done in JS with (length < 240 && !contains(':')?
That's not enough, see
<https://www.mediawiki.org/wiki/Manual:$wgLegalTitleChars>. Titles can
be rejected by Commons for other reasons too, so it's ok but not enough
to sanitise, ideally you'd also have a way to retry with a different
title if the upload is rejected.
|
@nemobis sure I discovered the API call: But we don't have any client-side logic at all at the moment so that will need some faffing about if we want it to be type-to-validate |
This allows users to adjust the name based on the title returned
in the IA metadata
Bug: T271423
This allows the user to violate the assumptions like no colons and can lead to a failed upload. Not quite sure how best to handle.