Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ extension tableMetadata {
return (contentType == "application/pdf" || contentType == "com.adobe.pdf")
}

var isCsv: Bool {
return (contentType == "text/csv")
}

/// Returns false if the user is lokced out of the file. I.e. The file is locked but by somone else
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling errors in the comment: 'lokced' should be 'locked' and 'somone' should be 'someone'.

Suggested change
/// Returns false if the user is lokced out of the file. I.e. The file is locked but by somone else
/// Returns false if the user is locked out of the file. I.e. The file is locked but by someone else

Copilot uses AI. Check for mistakes.
func canUnlock(as user: String) -> Bool {
return !lock || (lockOwner == user && lockOwnerType == 0)
Expand Down
12 changes: 12 additions & 0 deletions iOSClient/Viewer/NCViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ class NCViewer: NSObject {
}
return
}
// CSV
if metadata.isCsv {
let editors = utility.editorsDirectEditing(account: metadata.account, contentType: metadata.contentType)
if editors.contains("Nextcloud Text") {
qlPreview(viewController: viewController, metadata: metadata)
Copy link

Copilot AI Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing return statement after calling qlPreview. Without it, the code will continue executing and potentially trigger other viewers or the fallback qlPreview call at line 178, leading to duplicate preview attempts.

Suggested change
qlPreview(viewController: viewController, metadata: metadata)
qlPreview(viewController: viewController, metadata: metadata)
return

Copilot uses AI. Check for mistakes.
}
}

// RichDocument: Collabora
if metadata.isAvailableRichDocumentEditorView {
if metadata.url.isEmpty {
Expand Down Expand Up @@ -167,6 +175,10 @@ class NCViewer: NSObject {
}
}

qlPreview(viewController: viewController, metadata: metadata)
}

func qlPreview(viewController: UIViewController, metadata: tableMetadata) {
// QLPreview
let item = URL(fileURLWithPath: utilityFileSystem.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))
if QLPreviewController.canPreview(item as QLPreviewItem) {
Expand Down