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

[WIP] Make Commons filename editable #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

inductiveload
Copy link
Contributor

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.

@samwilson
Copy link
Member

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 pattern regex) but also duplicate names or anything matching filename-prefix-blacklist, etc.

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.

@inductiveload
Copy link
Contributor Author

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)
@inductiveload
Copy link
Contributor Author

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.

@nemobis
Copy link
Contributor

nemobis commented Jul 15, 2021 via email

@inductiveload
Copy link
Contributor Author

@nemobis sure

I discovered the API call: action=titleblacklist.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants