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

Version 3.4.0 couldNotDeleteFile error #196

Closed
AVDyadkovich opened this issue Oct 10, 2024 · 1 comment
Closed

Version 3.4.0 couldNotDeleteFile error #196

AVDyadkovich opened this issue Oct 10, 2024 · 1 comment

Comments

@AVDyadkovich
Copy link

AVDyadkovich commented Oct 10, 2024

For some reason I receive 3.4.0 version via SPM.

In that version, you have changed code in file class Files in method

func removeFileAndMetadata(_ metaData: UploadMetadata) throws {
        let filePath = metaData.filePath
        let fileName = filePath.lastPathComponent
        let metaDataPath = storageDirectory.appendingPathComponent(fileName).appendingPathExtension("plist")
        let uploadDataCachePath = storageDirectory.appendingPathComponent("\(metaData.id)uploadData")
        let metaDataCachePath = storageDirectory.appendingPathComponent("\(metaData.id)")
        
        try queue.sync {
            try FileManager.default.removeItem(at: metaDataPath)
            try FileManager.default.removeItem(at: metaDataCachePath)
            
            if FileManager.default.fileExists(atPath: uploadDataCachePath.path) {
                try FileManager.default.removeItem(at: uploadDataCachePath)
            }
#if os(iOS)
            try FileManager.default.removeItem(at: filePath)
#endif
        }

When upload is finished, I receive an error couldNotDeleteFile

The reason for that is I do not have anything in uploadDataCachePath.
On version 3.3.0 you have checking if uploadDataCachePath exist.

if FileManager.default.fileExists(atPath: metaDataCachePath.path) {
                try FileManager.default.removeItem(at: metaDataCachePath)
            }
@donnywals
Copy link
Collaborator

Hi @AVDyadkovich thanks for flagging this, looks like I had little too much faith in our test suite for this one..

I'll update tests and fix this issue with a new release later today.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants