Open willasm opened 1 year ago
hmm mine still has the first hash, are you logged into S/O?
That is what it was. I actually did not have an account but created one to test this (I use it enough anyways). This is an easy fix as well, I just changed the code a bit to this...
const urlPopped = url.split("/");
const urlLast = urlPopped.pop();
const urlSecondLast = urlPopped.pop();
if (urlSecondLast === "a") {
return urlLast;
}
return urlSecondLast;
This will work whether a user is logged in or not.
The example answer url you used has the ID at the as second last set of numbers..
https://stackoverflow.com/a/72722933/3952024
But now when it is copied from stackoverflow the ID is now at the end, like this...
https://stackoverflow.com/a/72722933
I was able to fix this in
main.js
by commenting out the first urlPopped.pop(); and now it works as expected.