Comments (5)
I am on Catalina. I think you are on to something. I believe it just so happens that the character combination I generate introduces a +
symbol in the base64 encoded string.
https://ray.so/?colors=midnight&background=true&darkMode=true&padding=64&title=Untitled-1&code=PD9waHAKCnNwcmludGYoIkhlbGxvIDxmZz15ZWxsb3c+JXMiLCAid29ybGQiKTsK
This will fail (because I think the browser interprets the + symbol as a space.
But when I urlencode the base64 encoded value:
https://ray.so/?colors=midnight&background=true&darkMode=true&padding=64&title=Untitled-1&code=PD9waHAKCnNwcmludGYoIkhlbGxvIDxmZz15ZWxsb3c%2BJXMiLCAid29ybGQiKTsK
It works!
Based on that it seems the solution is to replace any +
symbols in the generated CODE query parameter with %2B
. According to this doc, the only valid output character for a base64 encoded string that would need to be urlencoded is the +
, so this primitive approach seems adequate.
I can confirm that editing the script to this on lines 36 and 37 solves it (note I just added a bash replace-all syntax to the $CODE
variable here to replace any +
with %2B
).
CODE=$(pbpaste | base64)
CODE=${CODE//+/%2B}
Let me know if you'd like me to make a pull request for this.
from script-commands.
Follow up on this. I ran a test in order to determine whether base64
was mangling the content before sending it. I added an echo $CODE
in the script to see what it was producing. I got the string PD9waHAKCnNwcmludGYoIkhlbGxvIDxmZz15ZWxsb3c+JXMiLCAid29ybGQiKTsK
When I run base64 --decode
on it I get the expected results. So the correct string is being sent up to the server:
$ echo PD9waHAKCnNwcmludGYoIkhlbGxvIDxmZz15ZWxsb3c+JXMiLCAid29ybGQiKTsK | base64 --decode
<?php
sprintf("Hello <fg=yellow>%s", "world");
Edit: corrected example output
from script-commands.
Thanks for flagging this. I think the problem is that the open
command doesn't properly URL encode the query params. Are you on macOS Big Sur?
from script-commands.
Ah this is brilliant. Please go ahead and submit a PR. Your solutions seems very elegant. Please reference this issue in the PR and then we can close it when it got merged.
Thanks a lot for digging into it. Super appreciated.
from script-commands.
PR merged 👏
from script-commands.
Related Issues (20)
- allow recursive search in script directory HOT 1
- "Running script" continues indefinitely HOT 2
- My script commands is occasionally missing HOT 15
- I hope to set the default value and memory ability. HOT 2
- AppleScript missing icons HOT 1
- Can't stop script from running in the background HOT 5
- Script causes the dock to come into focus as if Finder was right-clicked HOT 5
- Integrating Automation workflows HOT 1
- audio-output-switch.template no longer works -- suggested changes below (verified on Intel MBP 16" running macOS Ventura 13.4.1) HOT 2
- default-browser-XXX scripts - Mac OS Sonoma HOT 4
- Toggle Natural Scrolling script does not work on Sonoma HOT 4
- Failing to start Raycast command scripts - MacOS Sonoma HOT 3
- Feature Request: Interactive mode HOT 4
- execute script via hotkey without opening raycast? HOT 1
- Disabling 'reopen windows' feature while using system restart command HOT 1
- Default browser scripts not working on Sonoma HOT 4
- commands/system/copy-availability.swift throws an error when run - "Symbols not found" HOT 2
- Clipboard content not getting set to the 1st Argument in Apple Music Search HOT 5
- [Feature request] Reusing argument with the same name in a QuickLink HOT 1
- Scripts in NodeJS: when explicitly exiting the process, the exit code is ignored by Raycast HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from script-commands.