shotstack-samples / build-me-a-video-twitter-bot

Create a Twitter bot that creates videos from tweets using the Shotstack API
https://twitter.com/BuildMeAVideo/
MIT License
22 stars 3 forks source link

single apostrophes get changed into quote marks #7

Closed joshuasorkin closed 2 years ago

joshuasorkin commented 2 years ago

to replicate:

  1. post a tweet with the text Hello's World.
  2. reply to the tweet with @buildMeAVideo
  3. A video gets posted with the text Hello"s World
joshuasorkin commented 2 years ago

The problem is in https://github.com/shotstack-samples/build-me-a-video-twitter-bot/blob/main/handlers/process/lib/render.js, line 13:

newString = string.replace(/'/g, '"');

This should instead be:

newString = string.replace(/'/g, ''');

or

newString = string.replace(/'/g, '’');

The latter is if you want to use a curly apostrophe ( ), which I think actually looks more professional in the final render. Interestingly, actually using a curly apostrophe in the tweet is a workaround, as it isn't a reserved character and passes through the render function unchanged.

This is a really easy fix; I'd be happy to submit a PR for this if you like.

Forpetesake2 commented 2 years ago

Good pickup. Didn't think of that one.

Yeah feel free submit a PR and I'll merge and deploy.

joshuasorkin commented 2 years ago

I'm getting a 403 on my end when I try git push origin apostrophe-fix; maybe you have to add me to the repo as a contributor?

EDIT: never mind, I forked it and pushed to my remote instead of trying to push to yours, and that solved the problem

joshuasorkin commented 2 years ago

Good pickup. Didn't think of that one.

Yeah feel free submit a PR and I'll merge and deploy.

PR submitted.

Forpetesake2 commented 2 years ago

Sweet thanks. Have merged and deployed. Changes are now live!