Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: starred in XML has mangled non-ISO 8601 #3104

Closed
3 tasks done
NattyNarwhal opened this issue Jun 19, 2024 · 2 comments
Closed
3 tasks done

[Bug]: starred in XML has mangled non-ISO 8601 #3104

NattyNarwhal opened this issue Jun 19, 2024 · 2 comments
Labels
bug triage New bug reports that need to be evaluated

Comments

@NattyNarwhal
Copy link

I confirm that:

  • I have searched the existing open AND closed issues to see if an issue already exists for the bug I've encountered
  • I'm using the latest version (your issue may have been fixed already)

Version

0.52.5-FREEBSD (c556088)

Current Behavior

On endpoints like getArtists, the starred property returns a non-ISO 8601 formatted date with my time zone instead of Z at the end, i.e. 2024-06-19T12:20:45.747872654-03:00. ISO 8601 parsers will reject this. This occurs with both XML and JSON responses.

Expected Behavior

A proper ISO 8601 date.

Steps To Reproduce

Call the endpoint.

Environment

- OS: FreeBSD 14.0

How Navidrome is installed?

Package

Configuration

# Navidrome Configuration File
# Anything that is commented out will use the default value shown
#
# Note: This file is installed by the port and not distributed as part of Navidrome

# Folder where your music library is stored. Can be read-only
MusicFolder = "/srv/music"
# Folder to store application data (DB, cache…).
#DataFolder 	= "/var/db/navidrome"
# How frequently to scan for changes in your music library. Set it to 0 to disable scans
ScanInterval = "1h"

# Log level. Useful for troubleshooting. Possible values: error, info, debug, trace. Default: info
LogLevel	= "info"

# HTTP port Navidrome will use
#Port		= 4533
# IP address the server will bind to. Comment out to use 0.0.0.0 and :: (all IPs)
#Address	= "127.0.0.1"

# Enables transcoding configuration in the UI
#EnableTranscodingConfig = false
# Size of transcoding cache. Set to 0 to disable cache
#TranscodingCacheSize 	= "100MB"
# Size of image (art work) cache. Set to 0 to disable cache
#ImageCacheSize			= "100MB"
# Enable/disable .m3u playlist auto-import
#AutoImportPlaylists		= true

# Base URL (only the path part) to configure Navidrome behind a proxy (ex: /music).  Comment out to leave empty
#BaseUrl				= ""
# Change background image used in the Login page.  Comment out to use random music image from Unsplash.com
#UILoginBackgroundUrl 	= ""
# Add a welcome message to the login screen
#UIWelcomeMessage		= ""
# Send basic info to your own Google Analytics account. Must be in the format UA-XXXXXXXX 	Empty (disabled)
#GATrackingID 			= ""

# List of ignored articles when sorting/indexing artists
#IgnoredArticles		= "The El La Los Las Le Les Os As O A"
# Match query strings anywhere in searchable fields, not only in word boundaries. Useful for languages where words are not space separated
#SearchFullString	= false

# Configure the order to look for cover art images. Use special embedded value to get embedded images from the audio files
#CoverArtPriority 	= "embedded, cover.*, folder.*, front.*"
# Set JPEG quality percentage for resized cover art images
#CoverJpegQuality	= 75
# Enable the option in the UI to download music/albums/artists/playlists from the server
EnableDownloads		= true

# How long Navidrome will wait before closing web ui idle sessions
#SessionTimeout		= "24h"
# How many login requests can be processed from a single IP during the AuthWindowLength. Set to 0 to disable the limit rater
#AuthRequestLimit	= 5
# Window Length for the authentication rate limit
#AuthWindowLength	= "20s"
# Select metadata extractor implementation. Options: taglib or ffmpeg
#Scanner.Extractor	= "taglib"

# Last.FM ApiKey
#LastFM.ApiKey		= ""
# Last.FM Shared Secret
#LastFM.Secret		= ""
# Two letter-code for language to be used to retrieve biographies from Last.FM 
#LastFM.Language	= "en"

# Spotify Client ID
#Spotify.ID		= ""
# Spotify Client Secret
#Spotify.Secret	= ""

# Use Gravatar images as the user profile image. Needs the user’s email to be filled.  Defaule: false
EnableGravatar	= true

Relevant log output

No response

Anything else?

I believe this was working in 0.52.x before, but I'm not sure what changed.

Code of Conduct

  • I agree to follow Navidrome's Code of Conduct
@NattyNarwhal NattyNarwhal added bug triage New bug reports that need to be evaluated labels Jun 19, 2024
@NattyNarwhal
Copy link
Author

Looks like an issue with Apple's ISO8601DateFormatter class - it doesn't like the sub-second precision, it doesn't mind the non-UTC timezone.

@NattyNarwhal
Copy link
Author

It seems Apple's class supports sub-second precision with the withFractionalSeconds option, but this then mandates fractional seconds, which other servers might not return. Seems the easier option is to have two parsers, like this simple contrived example:

let x = ISO8601DateFormatter()
let y = ISO8601DateFormatter()
y.formatOptions = [.withInternetDateTime, .withFractionalSeconds]

func parse(_ str: String) -> Date? {
    return x.date(from: str) ?? y.date(from: str)
}

Closing because I don't think Navidrome is at fault, it just returns more of the ISO 8601 animal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage New bug reports that need to be evaluated
Projects
None yet
Development

No branches or pull requests

1 participant