Autofill the version number when uploading a new file

JoshyPHP

Well-known member
When releasing a new version of a resource, the author has to provide the new file and a new version number. When the new version is manually entered, there's a possibility the number will be entered incorrectly. I don't know about other types of resources, but add-on files usually have the version number as part of their name; It makes it possible to autofill the "New version number" field based on the freshly uploaded file.

Here's my suggestion:
  1. When an author releases a new version,
  2. and the "New version number" field is empty,
  3. when a new file is uploaded in the form,
  4. and the file name ends with a string that matches a version number followed by the .zip extension,
  5. extract the version number and use it to fill the "New version number" field.

Limiting this suggestion to .zip files allows us to target add-ons without interfering with other types of contents. Add-on files are usually generated by XenForo and follow a predictable pattern.

The behaviour described above does not overwrite the version number if the author entered it manually, and does not prevent correcting it if it was incorrectly formatted or extracted from the file's name.
 

Attachments

  • rm-update.webp
    rm-update.webp
    12.4 KB · Views: 11
Upvote 10
Additionally, the process could check that the version is different to the last one, and reject/alert if not, to catch those times when developers forget to increment the numbering.
 
Back
Top Bottom