trilbymedia / grav-plugin-git-sync

Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Apache License 2.0
240 stars 58 forks source link

Username not URL-encoded #139

Closed leycec closed 5 years ago

leycec commented 5 years ago

Tragically, there appears to be a minor issue with respect to edge-case usernames containing URL-reserved characters (e.g., @, :, /). Attempting to synchronize these usernames raises the usual non-human-readable fatal error "port number ended with '{insert-random-character-here}'". Relevant StackOverflow thread.

Thankfully, this is trivially resolved by URL-encoding usernames (e.g., coercing all @ characters in usernames to %40 substrings). I can confirm that doing so manually resolves the aforementioned error, which is mildly nice. It would be nicer still, of course, if the plugin did so automatically on behalf of less webdev-inclined users.

Obligatory thanks for the fantastic Grav volunteerism, @w00fz, Trilby Media, and friends. Three gravitationally challenged thumbs up! :+1: :+1: :+1:

w00fz commented 5 years ago

Thanks @leycec, I didn't know you could have any special character in the username. I am unable to test this with the usual cloud services (GH, GL, BB) as these services do not allow anything other than alphanumerical, dash and underscore.

Although I am now urlencoding the username just to cover this edge case, if you could test my commit and confirm that helps your edge case that would be much appreciated!

leycec commented 5 years ago

Sweet. Thanks a Canadian metric tonne for the very rapid turnaround.

I didn't know you could have any special character in the username.

Yup! Bizarro World, right?

The most commonly allowed URL-reserved character in usernames appears to be the @ symbol, due to reuse of e-mail addresses as valid usernames by various hosts. The GitLab sign in page, for example, explicitly enables users to login with either a "Username or email." (It's the latter where our problems begin.)

Thankfully, our problems end here. GitSync is otherwise awesome – and probably the single most impressive Grav plugin we've played with yet. Cue vicious air guitar solo! :guitar: