Issue Details (XML | Word | Printable)

Key: MBS-4809
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Normal Normal
Assignee: Nicolás Tamargo
Reporter: Johannes Weißl
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
MusicBrainz Server

CC0 1.0 license isn't recognized by URLCleanup.js

Created: 30/May/12 07:28 PM   Updated: 10/Jun/12 03:06 PM   Resolved: 10/Jun/12 03:06 PM
Component/s: None
Affects Version/s: None
Fix Version/s: Bug fixes, 2012-06-11



Sort Order: Ascending order - Click to sort in descending order
Nicolás Tamargo added a comment - 31/May/12 12:06 AM

Heh, modified the code for this and later realised you assigned yourself. Should I submit it or will you do a patch that does both this and MBS-4810 in one go?


Johannes Weißl added a comment - 31/May/12 07:02 AM

No problem, now we can compare solutions . Mine was like this (don't have access to exact patch right now):

match: new RegExp("^(https?://)?([^/]+\\.)?(artlibre\\.org/licence|creativecommons\\.org/licenses/)", "i"),

-->

match: new RegExp("^(https?://)?([^/]+\\.)?(artlibre\\.org/licence|creativecommons\\.org/(licenses|publicdomain)/)", "i"),

and

url = url.replace(/^http:\/\/creativecommons\.org\/licenses\/(.+)\/((legalcode|deed)((\.|-)[A-Za-z_]+)?)?/, "http://creativecommons.org/licenses/$1/");

-->

url = url.replace(/^http:\/\/creativecommons\.org\/(licenses|publicdomain\/zero)\/(.+)\/((legalcode|deed)((\.|-)[A-Za-z_]+)?)?/, "http://creativecommons.org/$1/$2/");

What was your approach? As for MBS-4810, it is not that easily solvable as I thought, will comment there.


Nicolás Tamargo added a comment - 31/May/12 07:26 AM

Mine is exactly the same, except without the zero added there, just (licenses|publicdomain) - since if there are other publicdomain ones now or in the future, I'd expect us to want to support them too.


Nicolás Tamargo added a comment - 31/May/12 07:28 AM

And yeah, the other one is easy to solve dirtily, but of course

url = url.replace(/^(?:https?:\/\/)?(?:[^\/]+\.)?creativecommons\.org\/(.+)([^\/])$/, "http://creativecommons.org/$1$2/");

means that if the user enters a space or whatever, a new slash will be added, which is horrible


Johannes Weißl added a comment - 31/May/12 07:44 AM

Hmm, but does your code correctly normalize (= strip) "/legalcode" then from the URL? I had to include the "zero" because of that...


Nicolás Tamargo added a comment - 31/May/12 08:37 AM
url = url.replace(/^http:\/\/creativecommons\.org\/(licenses|publicdomain)\/(.+)\/((legalcode|deed)((\.|-)[A-Za-z_]+)?)?/, "http://creativecommons.org/$1/$2/");

seems to work OK for me in the sandbox, including stripping legalcode


Johannes Weißl added a comment - 31/May/12 05:20 PM

You are right ! You can assign this report to you and submit your patch for review if you like!