piroor / copy-selected-tabs-to-clipboard

Provides ability to copy title and URL of selected tabs to the clipboard for Firefox 63 and later.
Other
75 stars 15 forks source link

Error with some "Formats Strings" since version 1.50 #37

Closed claudio-salvio closed 8 months ago

claudio-salvio commented 1 year ago

Hello @piroor

Description

The following expressions worked correctly until version 1.5.0:

++%TST_INDENT(+)% [[%URL%{%DESCRIPTION%} %REPLACE("%TITLE%", "( - )?(http|ftp|https):\/([\w_-]+(?:(?:\, @?^=%&:\/~+#-]*[\w@?^=%&&\/~+#-])", "", " - ", " \w ", " - ", " \w ", " - ", " \w " )% ]]]

--%TST_INDENT(-)% [[%URL%{%DESCRIPTION%} %REPLACE("%TITLE%", "( - )?(http|ftp|https):\/([\w_-]+(?:(?:\, @?^=%&:\/~+#-]*[\w@?^=%&&\/~+#-])", "", " - ", " \w ", " - ", " \w ", " - ", " \w " )% ]]]

**%TST_INDENT(*)% [[%URL%{%DESCRIPTION%} %REPLACE("%TITLE%", "( - )?(http|ftp|https):\/(([\w_-]+(?:(?:\, [\w@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])", "", " - ", " "- ", " "- ", " "- ", " ", " " " )% \n]]]

Since version 1.5.0 the following error occurs:

Unhandled error: Unhandled error: Unknown placeholder: &:/~+#-]*[w@?^=
processPlaceHolder@moz-extension://859c1e96-a3d9-43f2-9a75-106c6da36a5a/common/commands.js:468:9
fillPlaceHoldersInternal/<@moz-extension://859c1e96-a3d9-43f2-9a75-106c6da36a5a/common/commands.js:356:12
process@moz-extension://859c1e96-a3d9-43f2-9a75-106c6da36a5a/common/placeholder-parser.js:108:21
process@moz-extension://859c1e96-a3d9-43f2-9a75-106c6da36a5a/common/placeholder-parser.js:193:21
fillPlaceHoldersInternal@moz-extension://859c1e96-a3d9-43f2-9a75-106c6da36a5a/common/commands.js:355:28
fillPlaceHolders@moz-extension://859c1e96-a3d9-43f2-9a75-106c6da36a5a/common/commands.js:321:44

Do I need to make any changes to make them work correctly with version 1.5.0?

Thank you for making this useful extension available to the community.

Best regards, Claudio Salvio

Environment

piroor commented 1 year ago

The "Unknown placeholder" error is a regression and fixed with the commit 4b3d5a3. You can try the development build at https://github.com/piroor/copy-selected-tabs-to-clipboard/actions/runs/3228974614 .

After that I've realized that your example regular expressions have some missing closers for (...) pairs (they need to be closed), and now the third example have some unpaired "s (" in double-quoted string need to be escaped). The handling of quotations in quotations is intentional uncompatibility and formats need to be updated.

I've tried to fixup your examples. Do them match to your demand?

++%TST_INDENT(+)% [[%URL%{%DESCRIPTION%} %REPLACE("%TITLE%", "( - )?(http|ftp|https):\/([\w_-]+(?:(?:\, @?^=%&:\/~+#-]*[\w@?^=%&&\/~+#-])))", "", " - ", " \w ", " - ", " \w ", " - ", " \w " )% ]]]

--%TST_INDENT(-)% [[%URL%{%DESCRIPTION%} %REPLACE("%TITLE%", "( - )?(http|ftp|https):\/([\w_-]+(?:(?:\, @?^=%&:\/~+#-]*[\w@?^=%&&\/~+#-])))", "", " - ", " \w ", " - ", " \w ", " - ", " \w " )% ]]]

**%TST_INDENT(*)% [[%URL%{%DESCRIPTION%} %REPLACE("%TITLE%", "( - )?(http|ftp|https):\/(([\w_-]+(?:(?:\, [\w@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-]))))", "", " - ", " \"- ", " \"- ", " \"- ", " ", " \" " )% \n]]]
claudio-salvio commented 1 year ago

Hello @piroor

Thanks for your prompt reply!

I get an error when trying to install the development build of the plugin despite having set xpinstall.signatures.required=false.

image

Any suggestions on this?

Regards, Claudio

piroor commented 1 year ago

The development build is unsigned so you need to load it as a temporary addon via about:debugging or use it on Nightly (development version of Firefox). But I already released v1.5.1 with the change yesterday, so you just need to update the installed version.

claudio-salvio commented 1 year ago

The development build is unsigned so you need to load it as a temporary addon via about:debugging or use it on Nightly (development version of Firefox). But I already released v1.5.1 with the change yesterday, so you just need to update the installed version.

🙏 Thanks for the advice and for releasing the 1.5.1 version.

claudio-salvio commented 1 year ago

@piroor

I was testing the following expression (also included in my initial post) using version 1.5.1 of the plugin:

**%TST_INDENT(*)% [[%URL%{%DESCRIPTION%} %REPLACE("%TITLE%", "( - )?(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])", "", " - ", " \n ", " - ", " \n ", " - ", " \n " )% \n]]

Something strange happened, the result of successive runs was not always the same despite using the same set of open tabs in Firefox.

From run to run it alternated between the expected result:

** [[https://www.google.com/search?q=thunderbird+list+line+background+color{} thunderbird list line background color \n Google Search \n]]
*** [[https://unix.stackexchange.com/questions/591827/thunderbird-change-selected-tags-background-color{} Thunderbird: change selected tags background color \n Unix & Linux Stack Exchange \n]]
*** [[https://support.mozilla.org/en-US/questions/1372038{} Set background colour of single column in message list | Thunderbird Support Forum | Mozilla Support \n]]
*** [[https://support.mozilla.org/en-US/questions/1372038#search{} Set background colour of single column in message list | Thunderbird Support Forum | Mozilla Support \n]]
**** [[https://support.mozilla.org/en-US/questions/1373626{} Highlight e-mail based on TAG color | Thunderbird Support Forum | Mozilla Support \n]]

and one that is not:

** [[https://www.google.com/search?q=thunderbird+list+line+background+color{} thunderbird list line background color \n Google Search \n]]
** [[https://unix.stackexchange.com/questions/591827/thunderbird-change-selected-tags-background-color{} Thunderbird: change selected tags background color \n Unix & Linux Stack Exchange \n]]
** [[https://support.mozilla.org/en-US/questions/1372038{} Set background colour of single column in message list | Thunderbird Support Forum | Mozilla Support \n]]
** [[https://support.mozilla.org/en-US/questions/1372038#search{} Set background colour of single column in message list | Thunderbird Support Forum | Mozilla Support \n]]
** [[https://support.mozilla.org/en-US/questions/1373626{} Highlight e-mail based on TAG color | Thunderbird Support Forum | Mozilla Support \n]]

Can you think of anything about that?

In case you find it useful, I usually use this expression to generate a section of a PlantUML MindMap based on the tab tree.

Claudio Salvio

piroor commented 8 months ago

Sorry for my long silence. I've confirmed the problem you last reported and fixed it with the commit a0ba941.