Skip to content

Conversation

7408647n
Copy link

@7408647n 7408647n commented Jul 6, 2025

Add a fallback for CSV files if the editor is Nextcloud-Text, as the Nextcloud-Text editor displays CSV files as text rather than as a table.

7408647n added 2 commits July 6, 2025 09:39
Add a fallback for CSV files if the editor is Nextcloud-Text, as the Nextcloud-Text editor displays CSV files as text rather than as a table.
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a fallback mechanism for CSV files when the Nextcloud-Text editor is being used, ensuring CSV files are displayed as tables rather than plain text. The change addresses a specific limitation where Nextcloud-Text displays CSV files in text format instead of the more user-friendly table format.

  • Adds detection logic to check if CSV files are being opened with Nextcloud-Text editor
  • Implements a fallback to QLPreview for better CSV file presentation
  • Refactors existing preview logic into a reusable function

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
iOSClient/Viewer/NCViewer.swift Adds CSV fallback logic and refactors QLPreview into separate function
iOSClient/Data/NCManageDatabase+Metadata.swift Adds isCsv computed property for CSV file detection

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
Preview

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.

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
Preview

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.

@mpivchev
Copy link
Collaborator

mpivchev commented Sep 5, 2025

Hi, I don't think we can merge this since we must use Nextcloud Text for files like this. I will check with the Nextcloud Text devs and see what we can do.

@mpivchev
Copy link
Collaborator

mpivchev commented Sep 5, 2025

In the meantime I can repurpose your code to open a csv in QTViewer only IF Nextcloud Text is not installed.

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

Successfully merging this pull request may close these issues.

2 participants