Popclip url seems to append %0A at the end of the text and therefore the browser could not reach the (internal, corporate) website. I had to manually remove the %0A and it works. Is there a way to overcome it?
# popclip
name: B
title: View ticket in B
icon: circle B
url: https://internal-website.com/BillingGeneral.faces?oppId=***
It’s not that PopClip is appending a %0A, exactly. Rather, if the selected text ends with a newline, then PopClip would encode that as a %0A. So it seems like there is a newline appearing at the end in whatever software you are selecting the search term from.
What we could do is make a Javascript snippet to preprocess the text to strip whitespace (newlines and spaces) from the ends:
# popclip
name: B
title: View ticket in B
icon: circle B
javascript: |
const searchTerm = encodeURIComponent(popclip.input.text.trim());
const rootUrl = "https://internal-website.com/BillingGeneral.faces?oppId=";
popclip.openUrl(rootUrl + searchTerm);
I think probably this should be the default behaviour. I’ll give it some thought.
No, I didn’t explain well. It doesn’t matter where you type the snippet. Drafts or TextEdit, has nothing to do with it. The %0A is a newline in the text that you select. It’s not appended, it’s in the selected text at the time you invoke the action. That’s why it’s encoded in the URL. The JS version specifically removes any newlines from the selected text.
See GIF, note that selection includes the next line: