wbkd / ddj-catalogue

DDJ-Katalog Frontend
http://katalog.datenjournalismus.net
8 stars 1 forks source link

URLs mit Hashes führen zu Submit-Error #1

Closed botic closed 9 years ago

botic commented 9 years ago

Will man eine URL einreichen, die ein Hash enthält, so kommt die Fehlermeldung: "Bitte geben Sie eine gültige URL an."

Beispiel: http://orf.at/wahl/eu14/ergebnisse/#ergebnisse

moklick commented 9 years ago

@botic thanks for the bug report. We will check that. I think it's a problem with the url regex we are using here https://github.com/wbkd/ddj-catalogue-backend/blob/master/src/controllers/submit.js

botic commented 9 years ago

A complete URL regex: https://github.com/ringo/ringojs/blob/master/modules/ringo/utils/strings.js#L30

But I don't think you need this level of detail ;-)

g-div commented 9 years ago

The valid-url module seems to be suitable for this purpose. It's more maintainable than a copy-pasted regex, even if your code looks really good :D

It's actually a shame that the Joi library can't validate URIs. :-1:

moklick commented 9 years ago

@g-div yeah, that's strange. I found this article about url validation regex https://mathiasbynens.be/demo/url-regex . It seems that there are a lot of problems with validating urls.. I will check the valid-url module, thanks!1

moklick commented 9 years ago

@g-div ha! https://github.com/hapijs/joi/pull/457

g-div commented 9 years ago

Jup, I had already seen the pull request and the related bugs, but the pull request isn't merged with master yet. :disappointed:

moklick commented 9 years ago

fixed. We are now using https://github.com/DavidTPate/isuri in order to validate URIs