Hi, I'm not sure why but when my fileURL is .jpg file and I drop the file from my app to Finder folders it make the dropped file as .jpeg Is there a way to fix it?
[.onDrag { if FileManager.default.fileExists(atPath: file.path) { // Provide the file as an item for dragging let fileURL = URL(fileURLWithPath: file.path) let itemProvider = NSItemProvider(contentsOf: fileURL)
// Remove the file extension in the suggestedName
let baseNameWithoutExtension = fileURL.deletingPathExtension().lastPathComponent
itemProvider?.suggestedName = baseNameWithoutExtension
return itemProvider ?? NSItemProvider()
} else {
// Handle the case where the file no longer exists
print("File no longer exists at path: \(file.path)")
return NSItemProvider()
}
})