-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
请问怎么推送一个链接? #18
Comments
内容有特殊符号时,需要url编码一下。
hzfmer <notifications@github.com>于2019年3月10日 周日21:34写道:
… 有时候推送的文本其实是一个网址, 有什么办法可以强行转义,保证推送的就是文本本身吗?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#18>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGhzWFCJuFb8JAYdvY7GsCfn2lb95K4Eks5vVQnLgaJpZM4bnQ7s>
.
|
@Finb
|
var urlResult=apiUrl+ encodeURI(text) +autoCopy;
确保 encodeURI 方法正常工作
hzfmer <notifications@github.com>于2019年3月10日 周日21:51写道:
… @Finb <https://github.com/Finb>
我是拿来直接用的, 找了个automator的workflow。普通文本没问题。
不过不好意思没用过js, 尝试着在workflow里修改了下,没有成功。
下面是workflow调用的js,能指导一下该如何编码吗? 多谢!
function run(input, parameters) {
var text=input;
var apiUrl="https://api.day.app/{MYKEY}/";
var autoCopy="?automaticallyCopy=1";
var urlResult=encodeURI(apiUrl+text+autoCopy);
return urlResult;
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGhzWGS7RvvJwFEk9ZCdNgpHotZYed5Fks5vVQ33gaJpZM4bnQ7s>
.
|
谢谢! 不过这样还是有点问题, 比如 copy 了
再推送的话,就推送不过来。 似乎相当于在 chrome 输入:
但是如果只是 copy
就会推送
总之, |
@hzfmer
你那是否有类似 encodeURIComponent 的方法? 需要这样对URL进行编码下 |
是的, 我今天自己研究了下,确实需要这样编码。 但是一个简单的workflow要加上这样的正则替换还是挺麻烦的,就先算了吧。 |
有时候推送的文本其实是一个网址, 有什么办法可以强行转义,保证推送的就是文本本身吗?
The text was updated successfully, but these errors were encountered: