Skip to content

fix: open file guid filename - WPB-23112#4266

Open
WilhelmOks wants to merge 9 commits intodevelopfrom
fix/WPB-23112-open-file-guid-filename
Open

fix: open file guid filename - WPB-23112#4266
WilhelmOks wants to merge 9 commits intodevelopfrom
fix/WPB-23112-open-file-guid-filename

Conversation

@WilhelmOks
Copy link
Collaborator

@WilhelmOks WilhelmOks commented Feb 4, 2026

BugWPB-23112 [iOS] Opening a pdf file shows GUID in place of file name

Issue

Files are downloaded locally and are given a long unreadable id as the filename. When we open them for preview, we see that unreadable filename.

My first idea was to just change the appearance of the filename in the preview view, but that's not possible because the "quicklook preview" system component that we are using always shows the filename from the source URL that it was given.

We can't just download the files with their readable filename because there would be conflicts with same filenames from different conversations, different folders and different file versions (from editing).

Temporary copying a file just for preview would also be not optimal, especially when the file is large.

So my solution is to download the files into folders with the names of the former filenames (unreadable ids) and inside those folders the filenames are the readable proper names of the files.
The quicklook preview doesn't show the folder names but only the clean filenames.
And there should be no conflicts of filenames because each of them is in a unique folder.

Testing

  • choose a file that you want to open in fullscreen preview
  • delete it and then restore again to clear the cached download
  • open the file
    • it should start the download and then open automatically. The file name should be the readable original filename.
  • open the file again
    • it should open right away because it's already downloaded. The file name should be the readable original filename.

Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

UI accessibility checklist

If your PR includes UI changes, please utilize this checklist:

  • Make sure you use the API for UI elements that support large fonts.
  • All colors are taken from WireDesign.ColorTheme or constructed using WireDesign.BaseColorPalette.
  • New UI elements have Accessibility strings for VoiceOver.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Test Results

2 629 tests   2 629 ✅  4m 49s ⏱️
  295 suites      0 💤
    2 files        0 ❌

Results for commit 79f8fe4.

♻️ This comment has been updated with latest results.

Summary: workflow run #21748567356
Allure report (download zip): html-report-27621-fix_WPB-23112-open-file-guid-filename

@datadog-wireapp
Copy link

datadog-wireapp bot commented Feb 4, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 79f8fe4 | Docs | Was this helpful? Give us feedback!

Copy link
Contributor

@samwyndham samwyndham left a comment

Choose a reason for hiding this comment

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

question: We are using the UIKit version of quicklook previews now right? Did you attempt to set the filename using https://developer.apple.com/documentation/quicklookui/qlpreviewitem/previewitemtitle

@WilhelmOks
Copy link
Collaborator Author

question: We are using the UIKit version of quicklook previews now right? Did you attempt to set the filename using https://developer.apple.com/documentation/quicklookui/qlpreviewitem/previewitemtitle

There is a place where we use the UIKit version, but that is just a workaround for a bug that was causing the quicklook preview to automatically close on ipad.
The code here is using the SwiftUI modifier. I did a quick research and apparently it's not possible to change the displayed title with the SwiftUI version.
And even if it was possible, it's not clear if the new filename would apply to all of the functions like "Save in Files", that are integrated in the system Quick Look view.

let pathWithoutExtension: String = if extensionComponents.count > 1 {
String(extensionComponents.dropLast().joined(separator: "."))
} else {
asset.cacheKey
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to cover the else branch with the unit tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now that you mention it, I think the else case will never trigger, actually. Because the cacheKey is built always with the pattern:
uuid + "_" + some_other_id + "." + file_extension
and then the new key becomes uuid + "_" + some_other_id + "/" + filename_with_extension
The else case is just a defensive fallback.
We can't test it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually I don't know what would happen if we had files without a file extension.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a unit test for files without extensions. Thanks for the suggestion.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
5.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

3 participants