You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After using the filecopy function, trying to open any file by double clicking it in the Finder only shows an error
What software is involved?
Operating System: macOS 14.3
Cryptomator: 1.12.0
FUSE-T: 1.0.35
Volume Type
FUSE-T
Steps to Reproduce
Build an app with the following code:
import Cocoa
@main
class AppDelegate: NSObject, NSApplicationDelegate {
private var textView: NSTextView!
func applicationDidFinishLaunching(_ aNotification: Notification) {
let scrollView = NSScrollView(frame: CGRect(x: 0, y: 0, width: 400, height: 400))
textView = NSTextView()
textView.autoresizingMask = [.width, .height]
scrollView.documentView = textView
let window = NSWindow(contentRect: scrollView.frame, styleMask: [.titled, .closable], backing: .buffered, defer: false)
window.contentView = scrollView
window.makeKeyAndOrderFront(nil)
let openPanel = NSOpenPanel()
openPanel.runModal()
let source = openPanel.urls[0]
openPanel.canChooseFiles = false
openPanel.canChooseDirectories = true
openPanel.runModal()
let destination = openPanel.urls[0].appendingPathComponent(source.lastPathComponent)
var fcError: NSError?
var _error: Error?
log("enter file coordinator")
NSFileCoordinator(filePresenter: nil).coordinate(readingItemAt: source, options: .withoutChanges, writingItemAt: destination, options: .forReplacing, error: &fcError) { source, destination in
do {
try source.withUnsafeFileSystemRepresentation { sourcePath in
try destination.withUnsafeFileSystemRepresentation { destinationPath in
let state = copyfile_state_alloc()
defer {
copyfile_state_free(state)
}
var bsize = UInt32(16_777_216)
if copyfile_state_set(state, UInt32(COPYFILE_STATE_BSIZE), &bsize) != 0 {
throw NSError(domain: NSPOSIXErrorDomain, code: Int(errno))
}
log("start copy")
if copyfile_state_set(state, UInt32(COPYFILE_STATE_STATUS_CB), unsafeBitCast(copyfileCallback, to: UnsafeRawPointer.self)) != 0 || copyfile_state_set(state, UInt32(COPYFILE_STATE_STATUS_CTX), unsafeBitCast(self, to: UnsafeRawPointer.self)) != 0 || copyfile(sourcePath, destinationPath, state, copyfile_flags_t(COPYFILE_ALL | COPYFILE_NOFOLLOW | COPYFILE_EXCL)) != 0 {
throw NSError(domain: NSPOSIXErrorDomain, code: Int(errno))
}
log("end copy")
}
}
} catch {
_error = error
}
}
log("exit file coordinator")
if let error = (fcError ?? _error) as NSError? {
log(error.localizedDescription)
log("\(error.domain) \(error.code)")
}
}
private let copyfileCallback: copyfile_callback_t = { what, stage, state, src, dst, ctx in
if what == COPYFILE_COPY_DATA {
if stage == COPYFILE_ERR {
return COPYFILE_QUIT
}
var size: off_t = 0
copyfile_state_get(state, UInt32(COPYFILE_STATE_COPIED), &size)
let delegate = unsafeBitCast(ctx, to: AppDelegate.self)
if !delegate.setCopyFileProgress(Int64(size)) {
return COPYFILE_QUIT
}
}
return COPYFILE_CONTINUE
}
private func setCopyFileProgress(_ progress: Int64) -> Bool {
log("copy callback with size \(progress)")
return true
}
private func log(_ string: String) {
textView.textStorage?.append(NSAttributedString(string: string + "\n", attributes: [.foregroundColor: NSColor.labelColor]))
}
}
When running the app, in the first open panel select a source file to be copied (e.g. from the Documents directory). In the second open panel, select a target directory in a Cryptomator vault where the source file should be copied into.
After the copy process has completed, double click a file in the Finder inside the Cryptomator vault.
Expected Behavior
No error should happen.
Actual Behavior
An error dialog like the one below is shown. Translated from German: "The file [...] could not be opened."
Note: I cannot reproduce this issue myself. I was made aware of this issue by a user of one of my apps, and they confirmed that the issue still happens when running the code shown above.
Reproducibility
Always
Relevant Log Output
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Please agree to the following
Summary
After using the filecopy function, trying to open any file by double clicking it in the Finder only shows an error
What software is involved?
Volume Type
FUSE-T
Steps to Reproduce
Expected Behavior
No error should happen.
Actual Behavior
An error dialog like the one below is shown. Translated from German: "The file [...] could not be opened."
Note: I cannot reproduce this issue myself. I was made aware of this issue by a user of one of my apps, and they confirmed that the issue still happens when running the code shown above.
Reproducibility
Always
Relevant Log Output
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: