         let fileExtension = url.pathExtension
         let filePath = url.lastPathComponent
         let fileName = filePath.replacingOccurrences(of: fileExtension, with: "")
-        return Int(String(fileName.characters.filter { "0123456789".characters.contains($0) }))
+        return Int(String(fileName.filter { "0123456789".contains($0) }))
     }
 }

            if let validPath = validPath {
                temporaryUrl = temporaryUrl.appendingPathComponent(validPath, isDirectory: false)
            }
            if temporaryUrl.absoluteString.lowercased().prefix(filePrefix.characters.count) != filePrefix {
                let fixedUrl = filePrefix + temporaryUrl.absoluteString
                temporaryUrl = URL(string: fixedUrl)!
            }

            .components(separatedBy: invalidCharacters)
            .joined(separator: "")
        let validFileName = removeSlashesAtBeginning(of: pathWithoutIllegalCharacters)
        guard validFileName.count > 0  && validFileName != "." else {
            throw createError(
                .invalidFileName,
                description: "\(originalString) is an invalid file name.",
