Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing dash in urls being dropped in sms - some android devices #96

Open
irfaan opened this issue May 11, 2017 · 8 comments
Open

Trailing dash in urls being dropped in sms - some android devices #96

irfaan opened this issue May 11, 2017 · 8 comments

Comments

@irfaan
Copy link

irfaan commented May 11, 2017

Just a PSA - I have noticed that, when texting a url with a trailing dash, some android devices are dropping the trailing dash when parsing urls in text messages. It seems to only happen when text follows a url with a trailing dash.

screen shot 2017-05-11 at 12 04 44 pm

@tsriram
Copy link

tsriram commented May 12, 2017

Happened to see the same issue today. As a quick fix I'm going to use ~ instead of - in the set of characters and hope it doesn't cause any problem :)

@irfaan
Copy link
Author

irfaan commented Jun 5, 2017

Edit Looks like some android devices drop the tilde, too. Agh!
screen shot 2017-06-05 at 2 47 57 pm

@tsriram Great idea. Will do the same. Thank you!
Section 2.3 of RFC 3986 confirms that ~ is url safe.

@irfaan irfaan closed this as completed Jun 5, 2017
@irfaan irfaan reopened this Jun 5, 2017
@tsriram
Copy link

tsriram commented Jun 6, 2017

@irfaan yeah, some (if not all) of Android devices drop tilde too. I'm currently doing a brute force way of generating shortid repeatedly till I get one that doesn't end with a special character. Not at all the best way but I was running out of time to dig into it. And can't have broken URLs sent to users!

@giiska
Copy link

giiska commented Aug 10, 2017

var shortid = require('shortid')
var shortidNotEndWithSpecialCharacter = function () {
  var id
  do {
    id = shortid.generate();
  }
  while(id[0] === '-' || id[0] === '_' || id.slice(-1) === '-' || id.slice(-1) === '_');
  return id;
}

@ai
Copy link
Collaborator

ai commented Aug 16, 2017

Removing IDS with last - is bad for uniformity. It is better to do shortid.generate().replace(/-/g, '~') or use nanoid

@asoesilo
Copy link

We saw the same issue with _, $ and @.

@ai
Copy link
Collaborator

ai commented Jul 8, 2018

Change alphabet by:

shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~_')

Or use Nano ID which use ~ instead of -.

@ai ai closed this as completed Jul 8, 2018
@ai ai reopened this Jul 8, 2018
@irfaan
Copy link
Author

irfaan commented Jul 14, 2018

@ai happens with tilde (~), too: #96 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants