Rarst / release-belt

Composer repository implementation for ZIPs.
MIT License
172 stars 16 forks source link

Improve filename parsing #5

Closed Rarst closed 9 years ago

Rarst commented 9 years ago

At the moment the version regex is overly simplistic with regex (|((?:\d+\.*){1,3})|) matching sequence of 1 to 3 version–like parts (digit(s) with a dot).

It needs to be more robust, but I do not want to force specific convention and renaming files on people. I want it to take wide (but reasonable) range of possibilities. See #4

I would like to collect example names from the wild for starters and iterate on regex from there.

If you provide or consume WP extensions in archives, please post example file names in this thread.

Collected examples

swissspidy commented 9 years ago

Looking through the downloads folder and trash:

Quite normal so far.

kraftner commented 9 years ago

Actually the example I gave in #4 wasn't a real world example. This is:

Other stuff, pretty normal:

Rarst commented 9 years ago

Thanks, folks! So far CF7 really putting a dent into it with that digit in name thing...

kraftner commented 9 years ago

Quickly went through the most popular plugins on wp.org to find some edge cases:

So by now we have

Rarst commented 9 years ago

I am concerned about actual commercial plugins. WP org repo is automated (devs have no control about filename format) and WPackagist's problem :)

kraftner commented 9 years ago

Sure. But still finding all those edge cases after 5 minutes probably makes it reasonable to assume that all this kind of crap will also be caught in the wild for commercial plugins.

Rarst commented 9 years ago

I guess, adding... (headache, I am slow today again)

Rarst commented 9 years ago

Ok, this handles everything we collected so far, except names ending in numbers. Which is really too ambiguous to handle.

grappler commented 9 years ago

I have found one that is not working fully. ninja-forms-mailchimp-v1.3.2.zip is being returned as ninja-forms-mailchimp-v

Rarst commented 9 years ago

Have added handling for optional v prefix in version.

Also the collected filenames are now included and checked against in unit test.