[GH-ISSUE #4] Handle trailing / in URL #2

Closed
opened 2026-03-23 20:34:29 +00:00 by mirror · 4 comments
Owner

Originally created by @p-rintz on GitHub (Apr 22, 2024).
Original GitHub issue: https://github.com/tubearchivist/tubearchivist-jf-plugin/issues/4

Originally assigned to: @DarkFighterLuke on GitHub.

This is kind of related to #3 , but the Plugin does not handle having a trailing / at the end of the Tubearchivist URL.

This leads to errors and the plugin silently failing (hence the relation to #3 )

I have no preference how this gets handled.
Could be a notice to not include it, handling it in code or throwing an error.

Originally created by @p-rintz on GitHub (Apr 22, 2024). Original GitHub issue: https://github.com/tubearchivist/tubearchivist-jf-plugin/issues/4 Originally assigned to: @DarkFighterLuke on GitHub. This is kind of related to #3 , but the Plugin does not handle having a trailing / at the end of the Tubearchivist URL. This leads to errors and the plugin silently failing (hence the relation to #3 ) I have no preference how this gets handled. Could be a notice to not include it, handling it in code or throwing an error.
Author
Owner

@ThisIsHetz commented on GitHub (Apr 23, 2024):

Prefacing this with my usual disclaimer of "I'm not a dev", PluginConfiguration.cs calls to Utils.cs for SanitizeUrl() to sanitize the value provided for _tubeArchivistUrl (the variable for the field where your TA URL goes in the plugin form):

public static string SanitizeUrl(string inputURL)
{
...
  cleanedPath = cleanedPath.TrimStart('/');
  cleanedPath = cleanedPath.TrimEnd('/') + "/";
...

Assuming I understand all of the above correctly, SanitizeUrl() explicitly adds a trailing forward slash in the event one isn't included. It actually removes all trailing forward slashes, if any are included, before appending just one; akin to a cleanedPath = cleanedPath.rstrip('/') + "/" in Python.

That the plugin actually forces a trailing slash, in combination with a "works on my machine" (I included a slash, when configuring the plugin, without issue), makes me wonder if this could be a symptom of another issue.

<!-- gh-comment-id:2072034151 --> @ThisIsHetz commented on GitHub (Apr 23, 2024): Prefacing this with my usual disclaimer of "I'm not a dev", PluginConfiguration.cs calls to Utils.cs for `SanitizeUrl()` to sanitize the value provided for `_tubeArchivistUrl` (the variable for the field where your TA URL goes in the plugin form): ```csharp public static string SanitizeUrl(string inputURL) { ... cleanedPath = cleanedPath.TrimStart('/'); cleanedPath = cleanedPath.TrimEnd('/') + "/"; ... ``` Assuming I understand all of the above correctly, `SanitizeUrl()` explicitly adds a trailing forward slash in the event one isn't included. It actually removes all trailing forward slashes, if any are included, before appending just one; akin to a `cleanedPath = cleanedPath.rstrip('/') + "/"` in Python. That the plugin actually forces a trailing slash, in combination with a "works on my machine" (I included a slash, when configuring the plugin, without issue), makes me wonder if this could be a symptom of another issue.
Author
Owner

@p-rintz commented on GitHub (Apr 23, 2024):

Hm. Not entirely sure. The issue showed itself on my side as permission denied errors or the like, and the only thing I changed, before it started working, was the trailing slash in the plugin config, so I assumed that it was that.

Not sure what else it would be.

<!-- gh-comment-id:2072107121 --> @p-rintz commented on GitHub (Apr 23, 2024): Hm. Not entirely sure. The issue showed itself on my side as permission denied errors or the like, and the only thing I changed, before it started working, was the trailing slash in the plugin config, so I assumed that it was that. Not sure what else it would be.
Author
Owner

@DarkFighterLuke commented on GitHub (Apr 24, 2024):

Hi @p-rintz , I have just tested it (again) on my machine and it works, so the problem is not here.
Maybe you should include your logs, thanks.

<!-- gh-comment-id:2074353187 --> @DarkFighterLuke commented on GitHub (Apr 24, 2024): Hi @p-rintz , I have just tested it (again) on my machine and it works, so the problem is not here. Maybe you should include your logs, thanks.
Author
Owner

@p-rintz commented on GitHub (Apr 24, 2024):

If you cant reproduce it on your side, Ill just close this issue for now and reopen a new one if I can find out what else it was that made it not work. Thanks for your help.

<!-- gh-comment-id:2074357062 --> @p-rintz commented on GitHub (Apr 24, 2024): If you cant reproduce it on your side, Ill just close this issue for now and reopen a new one if I can find out what else it was that made it not work. Thanks for your help.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
tubearchivist/archived-tubearchivist-jf-plugin#2
No description provided.