Skip to content

[WIP] Make Commons filename editable#56

Open
inductiveload wants to merge 1 commit intowikisource:mainfrom
inductiveload:editable
Open

[WIP] Make Commons filename editable#56
inductiveload wants to merge 1 commit intowikisource:mainfrom
inductiveload:editable

Conversation

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

nemobis commented Jul 15, 2021 via email

@inductiveload
Copy link
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

3 participants