Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
fix url::makeAbsolute() and url::short() #213
Instead of filing issues I now try to fix issues :)
I had a bug that came down to relying on
So I made a few tests for urls it should solve in my opinion, and then I rewrote the function. It now passes all those tests, and also the tests on $home as
I also noticed that
I found a new case which it didn't solve (https://webmention.rocks/test/22), so I added a test for that too. And then I had to completely redo the function again. I think this is a way better approach: it now filters and alters the fragments as an array, and calls
Also had to fix
Sad to admit, but this does potentially break some things. I had the following code on my site:
Which worked relative to my root. Now it breaks, because it's relative to the page. Luckily it is as easy as adding a
Unfortunately, this exact code is also present in Kirby's Starterkit. Don't know how you guys want to handle that.
Edit: also found that (of course)
Would it help to rename this function to
The toolkit just really needs a function like this.
Also: relative urls like
Okay, I renamed the function. While I was doing so, it made sense to switch the order of the params, and make them both required. This is now a function to solve relativeness from a $base to another url. (I kept the second param as $path though, because $url would be confusing.)
Also renamed the tests, got rid of the tests with only a $path, and changed the wording on the doc on url::makeAbsolute(). :)
Seems like the checks fail, updating my repo now..