[GH-ISSUE #39] [Bug]:Spaces in usernames not handled #31

Closed
opened 2026-03-23 20:35:10 +00:00 by mirror · 3 comments
Owner

Originally created by @stonkage on GitHub (Mar 4, 2025).
Original GitHub issue: https://github.com/tubearchivist/tubearchivist-jf-plugin/issues/39

I've read the documentation

Operating System

Linux

Your Bug Report

Describe the bug

TA Plugin doesn't appear to be able to sync if the jellyfin user as a space (see log)

The space is removed from the gui after saving the setting and refreshing the page

Steps To Reproduce

Create user with a space in its name
Wait for sync
Observe failure

Expected behavior

It would sync

Relevant Jellyfin log output

[2025-03-04 16:45:52.453 +10:30] [INF] "Jellyfin user with username RobandShan not found"
[2025-03-04 16:45:52.453 +10:30] [INF] Found a total of 0 videos
[2025-03-04 16:45:52.453 +10:30] [INF] "Jellyfin user with username RobandShan not found"
[2025-03-04 16:45:52.453 +10:30] [INF] Time elapsed: 00:00:00.0002067

Anything else?

No response

Originally created by @stonkage on GitHub (Mar 4, 2025). Original GitHub issue: https://github.com/tubearchivist/tubearchivist-jf-plugin/issues/39 ### I've read the documentation - [x] I'm running the latest version of tubearchivist-jf-plugin. - [x] I have read the [how to open an issue](https://github.com/tubearchivist/tubearchivist/blob/master/CONTRIBUTING.md#how-to-open-an-issue) guide, particularly the [bug report](https://github.com/tubearchivist/tubearchivist/blob/master/CONTRIBUTING.md#bug-report) section. ### Operating System Linux ### Your Bug Report ## Describe the bug TA Plugin doesn't appear to be able to sync if the jellyfin user as a space (see log) The space is removed from the gui after saving the setting and refreshing the page ## Steps To Reproduce Create user with a space in its name Wait for sync Observe failure ## Expected behavior It would sync ### Relevant Jellyfin log output ```shell [2025-03-04 16:45:52.453 +10:30] [INF] "Jellyfin user with username RobandShan not found" [2025-03-04 16:45:52.453 +10:30] [INF] Found a total of 0 videos [2025-03-04 16:45:52.453 +10:30] [INF] "Jellyfin user with username RobandShan not found" [2025-03-04 16:45:52.453 +10:30] [INF] Time elapsed: 00:00:00.0002067 ``` ### Anything else? _No response_
Author
Owner

@mattkduran commented on GitHub (Mar 7, 2025):

It looks like this is related to this code block here in PluginConfiguration.cs

public string JFUsernamesTo
{
    get
    {
        _logger.LogDebug("JFUsernamesTo configured: {Message}", string.Join(", ", _jfUsernamesTo));
        return string.Join(", ", _jfUsernamesTo);
    }

    set
    {
        value.Replace(" ", string.Empty, StringComparison.CurrentCulture).Split(',').ToList().ForEach(u => _jfUsernamesTo.Add(u));
        _logger.LogDebug("Set JFUsernamesTo to: {Message}", value);
    }
}

The replace portion on line 127 is stripping all spaces in the string which leads to usernames with spaces having them cleared out.

I think the setter could be modified like this which would split on commas then trim any leading or trailing spaces while leaving the spaces in the middle of the string.

    set
    {
        // Clear existing usernames
        _jfUsernamesTo.Clear();
        
        // Split by comma, then trim each part to remove leading/trailing spaces
        foreach (var username in value.Split(','))
        {
            var trimmedUsername = username.Trim();
            if (!string.IsNullOrEmpty(trimmedUsername))
            {
                _jfUsernamesTo.Add(trimmedUsername);
            }
        }
        
        _logger.LogDebug("Set JFUsernamesTo to: {Message}", value);
    }
<!-- gh-comment-id:2705523785 --> @mattkduran commented on GitHub (Mar 7, 2025): It looks like this is related to this code block here in [PluginConfiguration.cs](https://github.com/tubearchivist/tubearchivist-jf-plugin/blob/ab96b227a146d66e93c54490376bd824faefea7d/Jellyfin.Plugin.TubeArchivistMetadata/Configuration/PluginConfiguration.cs#L117) ``` public string JFUsernamesTo { get { _logger.LogDebug("JFUsernamesTo configured: {Message}", string.Join(", ", _jfUsernamesTo)); return string.Join(", ", _jfUsernamesTo); } set { value.Replace(" ", string.Empty, StringComparison.CurrentCulture).Split(',').ToList().ForEach(u => _jfUsernamesTo.Add(u)); _logger.LogDebug("Set JFUsernamesTo to: {Message}", value); } } ``` The replace portion on line 127 is stripping all spaces in the string which leads to usernames with spaces having them cleared out. I think the setter could be modified like this which would split on commas then trim any leading or trailing spaces while leaving the spaces in the middle of the string. ``` set { // Clear existing usernames _jfUsernamesTo.Clear(); // Split by comma, then trim each part to remove leading/trailing spaces foreach (var username in value.Split(',')) { var trimmedUsername = username.Trim(); if (!string.IsNullOrEmpty(trimmedUsername)) { _jfUsernamesTo.Add(trimmedUsername); } } _logger.LogDebug("Set JFUsernamesTo to: {Message}", value); } ```
Author
Owner

@mattkduran commented on GitHub (Mar 7, 2025):

I added a pull request for it here with one that I previously submitted -- hoping it gets reviewed soon!
https://github.com/tubearchivist/tubearchivist-jf-plugin/pull/38

<!-- gh-comment-id:2705536088 --> @mattkduran commented on GitHub (Mar 7, 2025): I added a pull request for it here with one that I previously submitted -- hoping it gets reviewed soon! https://github.com/tubearchivist/tubearchivist-jf-plugin/pull/38
Author
Owner

@DarkFighterLuke commented on GitHub (Mar 10, 2025):

Thanks for your contribution!

<!-- gh-comment-id:2711926587 --> @DarkFighterLuke commented on GitHub (Mar 10, 2025): Thanks for your contribution!
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#31
No description provided.