8000 8000
Skip to content

Filenames are needlessly truncated #9

Description

@ericfrederich

The call to filenamify.Filenamify() is truncating filenames.
It defaults to 100 which isn't great.
Quick fix would be to change all 3 instances of filenamify.Options{} to filenamify.Options{MaxLength: 255}
This seems safe on Windows and Linux after some brief googling.

The real problem is that this external library doesn't even try to retain file extensions.
Either that library should attempt to maintain the extension or godeez could call Filenamify() with 255 - (len(extension) + 1) and then add it afterwards to guarantee it's there.

A proper way on Linux at least there's a subprocess you could call getconf NAME_MAX /path/to/directory that would tell you the max length filename allowed in a particular directory.

'10. Grateful Dead - Not Fade Away, Pt. 2 (Live at the Capitol Theatre, Port Chester, NY, 2!18!71).flac'
becomes
'10. Grateful Dead - Not Fade Away, Pt. 2 (Live at the Capitol Theatre, Port Chester, NY, 2!18!71).fl'

'5. Grateful Dead - Greatest Story Ever Told (Live at the Capitol Theatre, Port Chester, NY, 2!18!71).flac'
becomes
'5. Grateful Dead - Greatest Story Ever Told (Live at the Capitol Theatre, Port Chester, NY, 2!18!71)'

'8. Grateful Dead - Not Fade Away, Pt. 1 (Live at the Capitol Theatre, Port Chester, NY, 2!18!71).flac'
becomes
'8. Grateful Dead - Not Fade Away, Pt. 1 (Live at the Capitol Theatre, Port Chester, NY, 2!18!71).fla'

'9. Grateful Dead - Goin' Down The Road Feeling Bad (Live at the Capitol Theatre, Port Chester, NY, 2!18!71).flac'
becomes
'9. Grateful Dead - Goin' Down The Road Feeling Bad (Live at the Capitol Theatre, Port Chester, NY, 2'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0