mirror of
https://github.com/Finb/Bark.git
synced 2026-04-26 22:45:49 +03:00
[GH-ISSUE #18] 请问怎么推送一个链接? #16
Labels
No labels
bug
enhancement
in progress
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Bark#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hzfmer on GitHub (Mar 10, 2019).
Original GitHub issue: https://github.com/Finb/Bark/issues/18
有时候推送的文本其实是一个网址, 有什么办法可以强行转义,保证推送的就是文本本身吗?
@Finb commented on GitHub (Mar 10, 2019):
内容有特殊符号时,需要url编码一下。
hzfmer notifications@github.com于2019年3月10日 周日21:34写道:
@hzfmer commented on GitHub (Mar 10, 2019):
@Finb
我是拿来直接用的, 找了个automator的workflow。普通文本没问题。
不过不好意思没用过js, 尝试着在workflow里修改了下,没有成功。
下面是workflow调用的js,能指导一下该如何编码吗? 多谢!
@Finb commented on GitHub (Mar 10, 2019):
var urlResult=apiUrl+ encodeURI(text) +autoCopy;
确保 encodeURI 方法正常工作
hzfmer notifications@github.com于2019年3月10日 周日21:51写道:
@hzfmer commented on GitHub (Mar 10, 2019):
谢谢!
不过这样还是有点问题, 比如 copy 了
再推送的话,就推送不过来。 似乎相当于在 chrome 输入:
但是如果只是 copy
就会推送
总之,
https://会被忽略 (严格来说还是连带 https 一起推送更好) , 而/出现超过一次就可能推送失败了。看起来应该还是 url 编码的问题?@Finb commented on GitHub (Mar 11, 2019):
@hzfmer
对,因为:// 破坏了 URL 的结构,
如果有这种特殊字符,需要URL编码
你这里的情况需要这样
你那是否有类似 encodeURIComponent 的方法? 需要这样对URL进行编码下
@hzfmer commented on GitHub (Mar 11, 2019):
是的, 我今天自己研究了下,确实需要这样编码。 但是一个简单的workflow要加上这样的正则替换还是挺麻烦的,就先算了吧。
总之多谢!