URL saved in database without %20 characters #3404
Replies: 3 comments 9 replies
-
Cannot reproduce.
|
Beta Was this translation helpful? Give feedback.
-
Well, I think I'm reaching a final solution now, thanks. It's a bit unkind to call it an "invalid edge case". The URLs I am starting out with are simply Linux file paths (which quite legally include blanks). Bitly's API handles them happily, but I accept your comment that it isn't worth putting extra functionality into YOURLS. There is a somewhat simpler alternative to my earlier code, but the first step needed is to turn the Linux file path into a valid URL path. That can be achieved in PHP with:
That amount of complexity seems unavoidable. Once that has been achieved, then it is possible to rawurlencode the entire URL to pass to YOURLS. What isn't workable is to do what was implied in an earlier comment somewhere to "double" urlencode. (PHP's parse_url is capable of returning more than just scheme, host and path, but the other items do not arise when the parameter is a Linux file path) A further simplification can be achieved by using PHP's http_build_query function, which will implicitly urlencode the URL:
|
Beta Was this translation helpful? Give feedback.
-
I should add that I'm grateful to you and your colleagues who work on YOURLS. I'm a strong supporter of open source (and create some). The final result is now looking good, thanks. |
Beta Was this translation helpful? Give feedback.
-
THe original URL saved in database is stripped of spaces and on opening Short URL we get 404 error.
Beta Was this translation helpful? Give feedback.
All reactions