Skip to content

Crash on indexing files whose filename starts with the year. #28

@joshkerr

Description

@joshkerr

When Fetch matches files to metadata it can crash if your movie has the date at the beginning of the filename. Create a folder and movie with the following title and Downpour will throw an error:

1984.1984.720p.BluRay.H264.AAC.mp4

The error is happening in Downpour.swift line 151:

} else if year != nil {
                let endIndex = rawString.index(rawString.range(of: year!)!.lowerBound, offsetBy: -1)
                return rawString[rawString.startIndex...endIndex].cleanedString
            }

I think the index is going out of range due to the offset, but I could be wrong. Its been a longtime since I've written code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions