Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrebane committed Jun 13, 2024
1 parent 9dcaa87 commit 4c2023b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 75 deletions.
4 changes: 0 additions & 4 deletions MoppApp/MoppApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@
DFDF02BE241EB5D3006CF443 /* SessionCertificate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFDF02BD241EB5D3006CF443 /* SessionCertificate.swift */; };
DFDF02C0241EC72D006CF443 /* SessionStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFDF02BF241EC72C006CF443 /* SessionStatus.swift */; };
DFDF02C4241ED0CA006CF443 /* MobileIDSignature.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFDF02C3241ED0CA006CF443 /* MobileIDSignature.swift */; };
DFE7B68A2C191A1200C598FC /* URL+Additions.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFE7B6892C191A1200C598FC /* URL+Additions.swift */; };
DFEE73042A151423003428E4 /* ScaledTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEE73032A151423003428E4 /* ScaledTextView.swift */; };
DFEFF8DD2AD6DCE3003D452B /* TokenFlowSigning.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEFF8DC2AD6DCE3003D452B /* TokenFlowSigning.swift */; };
DFF3C3AE233231190079458A /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFF3C3AC233231180079458A /* Configuration.swift */; };
Expand Down Expand Up @@ -605,7 +604,6 @@
DFDF02BD241EB5D3006CF443 /* SessionCertificate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionCertificate.swift; sourceTree = "<group>"; };
DFDF02BF241EC72C006CF443 /* SessionStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionStatus.swift; sourceTree = "<group>"; };
DFDF02C3241ED0CA006CF443 /* MobileIDSignature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MobileIDSignature.swift; sourceTree = "<group>"; };
DFE7B6892C191A1200C598FC /* URL+Additions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Additions.swift"; sourceTree = "<group>"; };
DFEE73032A151423003428E4 /* ScaledTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScaledTextView.swift; sourceTree = "<group>"; };
DFEEFCCD29AD062C0013E66B /* DiagnosticError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticError.swift; sourceTree = "<group>"; };
DFEFF8DC2AD6DCE3003D452B /* TokenFlowSigning.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenFlowSigning.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -734,7 +732,6 @@
DFF3C3B4233231F20079458A /* Notification+Additions.swift */,
DF13562D2902018A00F61823 /* MoppApp+Additions.swift */,
DF8A948929AFD11A004F6E4B /* CharacterSet+Additions.swift */,
DFE7B6892C191A1200C598FC /* URL+Additions.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -1682,7 +1679,6 @@
C593D9F0208F1C16000B3BF6 /* SettingsFieldCell.swift in Sources */,
C593D9E8208F1986000B3BF6 /* SettingsViewController.swift in Sources */,
DFBDF20227DF7ED700A5CF3C /* IDCardSignature.swift in Sources */,
DFE7B68A2C191A1200C598FC /* URL+Additions.swift in Sources */,
C54EA6E520444EC90039AC78 /* TokenFlowSelectionViewController.swift in Sources */,
DFF3C3B32332314A0079458A /* SignatureVerifier.swift in Sources */,
DF17ABCE29C0F86E009711DF /* BarButton.swift in Sources */,
Expand Down
30 changes: 0 additions & 30 deletions MoppApp/MoppApp/Extensions/URL+Additions.swift

This file was deleted.

13 changes: 0 additions & 13 deletions MoppApp/MoppApp/FileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,6 @@ class MoppFileManager {

func removeFile(withPath filePath: String) {
let filePathURL = URL(fileURLWithPath: filePath)
guard filePathURL.isValidPath() else {
printLog("Unable to remove file. Invalid path: \(filePathURL.path)")
return
}

do {
try fileManager.removeItem(atPath: FileUtil.getValidPath(url: filePathURL)?.path ?? "")
} catch {
Expand All @@ -333,10 +328,6 @@ class MoppFileManager {

func fileExists(_ sourcePath: String) -> Bool {
let sourcePathURL = URL(fileURLWithPath: sourcePath)
guard sourcePathURL.isValidPath() else {
printLog("Unable to check if file exists. Invalid path: \(sourcePathURL.path)")
return false
}
return fileManager.fileExists(atPath: FileUtil.getValidPath(url: sourcePathURL)?.path ?? "")
}

Expand All @@ -349,10 +340,6 @@ class MoppFileManager {
func moveFile(withPath sourcePath: String, toPath destinationPath: String, overwrite: Bool) -> Bool {
let sourcePathURL = URL(fileURLWithPath: sourcePath)
let destinationPathURL = URL(fileURLWithPath: destinationPath)
guard sourcePathURL.isValidPath() && destinationPathURL.isValidPath() else {
printLog("Unable to move file to destination. Invalid path: \(sourcePathURL.path) or \(destinationPathURL.path)")
return false
}
if overwrite && fileExists(FileUtil.getValidPath(url: destinationPathURL)?.path ?? "") {
removeFile(withPath: FileUtil.getValidPath(url: destinationPathURL)?.path ?? "")
}
Expand Down
16 changes: 0 additions & 16 deletions MoppApp/MoppApp/MimeTypeExtractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,11 @@ class MimeTypeExtractor {
}

private static func removeUnzippedFolder(folderPath: URL) -> Void {
guard folderPath.isValidPath() else {
printLog("Unable to remove unzipped folder. Invalid path: \(folderPath.path)")
return
}

MoppFileManager().removeFile(withPath: FileUtil.getValidPath(url: folderPath)?.path ?? "")
}

private static func isDdoc(url: URL) -> Bool {
guard url.isValidPath(), FileUtil.getValidPath(url: url) != nil else {
printLog("Unable to check if file is DDOC container. Invalid path: \(url.path)")
return false
}

do {

let fileData = try Data(contentsOf: FileUtil.getValidPath(url: url)!)
guard !fileData.isEmpty else {
return false
Expand All @@ -224,11 +213,6 @@ class MimeTypeExtractor {
}

private static func isCdoc(url: URL) -> Bool {
guard url.isValidPath(), FileUtil.getValidPath(url: url) != nil else {
printLog("Unable to check if file is CDOC container. Invalid path: \(url.path)")
return false
}

do {
let fileData = try Data(contentsOf: FileUtil.getValidPath(url: url)!)
guard !fileData.isEmpty else {
Expand Down
12 changes: 0 additions & 12 deletions MoppApp/MoppApp/MoppApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,6 @@ class MoppApp: UIApplication, URLSessionDelegate, URLSessionDownloadDelegate {
pathExtension = MimeTypeExtractor.determineContainer(mimetype: MimeTypeExtractor.getMimeTypeFromContainer(filePath: newUrl), fileExtension: newUrl.pathExtension)

do {
guard newUrl.isValidPath(), FileUtil.getValidPath(url: url) != nil else {
printLog("Unable to open file. Invalid path: \(newUrl.path)")
return false
}
let validUrl = FileUtil.getValidPath(url: url)!
let newData: Data? = try Data(contentsOf: validUrl)
let fileName: String = validUrl.deletingPathExtension().lastPathComponent.sanitize()
Expand All @@ -344,10 +340,6 @@ class MoppApp: UIApplication, URLSessionDelegate, URLSessionDownloadDelegate {
return false
}
do {
guard filePath.isValidPath(), FileUtil.getValidPath(url: url) != nil else {
printLog("Unable to write to file. Invalid path: \(filePath.path)")
return false
}
try newUrlData.write(to: FileUtil.getValidPath(url: filePath)!, options: .atomic)
newUrl = validUrl
if !isFileEmpty {
Expand Down Expand Up @@ -376,10 +368,6 @@ class MoppApp: UIApplication, URLSessionDelegate, URLSessionDownloadDelegate {
newUrl.deletePathExtension()
newUrl.appendPathExtension(ContainerFormatCdoc)
}
guard url.isValidPath(), newUrl.isValidPath() else {
printLog("Unable to move file. Invalid path: \(newUrl.path)")
return false
}
let isFileMoved = MoppFileManager.shared.moveFile(withPath: FileUtil.getValidPath(url: url)?.path ?? "", toPath: FileUtil.getValidPath(url: newUrl)?.path ?? "", overwrite: true)
if !isFileMoved {
newUrl = url
Expand Down

0 comments on commit 4c2023b

Please sign in to comment.