From 8e28242eafdc7e8694dc17a4e282c0d604f0654b Mon Sep 17 00:00:00 2001 From: Storm Timmermans Date: Thu, 11 Mar 2021 15:13:00 +0100 Subject: [PATCH] fix(targets/plex): add trailing slash to libraries (#102) --- targets/plex/api.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/targets/plex/api.go b/targets/plex/api.go index 59a56ea0..26b31b0b 100644 --- a/targets/plex/api.go +++ b/targets/plex/api.go @@ -127,10 +127,17 @@ func (c apiClient) Libraries() ([]library, error) { libraries := make([]library, 0) for _, lib := range resp.MediaContainer.Libraries { for _, folder := range lib.Sections { + libPath := folder.Path + + // Add trailing slash if there is none. + if len(libPath) > 0 && libPath[len(libPath)-1] != '/' { + libPath += "/" + } + libraries = append(libraries, library{ Name: lib.Name, ID: lib.ID, - Path: folder.Path, + Path: libPath, }) } }