Closed Bug 1825006 Opened 2 years ago Closed 2 years ago

FileSystemFileHandle.getFile() returns an object with an incorrect file name

Categories

(Core :: DOM: File, defect)

Firefox 111
defect

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: use-strict, Assigned: jjalkanen)

References

Details

(Keywords: parity-chrome)

Attachments

(2 files)

Steps to reproduce:

await (async () => {
let dir = await navigator.storage.getDirectory();
let handle = await dir.getFileHandle("test.txt", { create: true });
let file = await handle.getFile();
console.log(handle.name); // test.txt
console.log(file.name); // 6NW2MUFR2JJZN5PNB5FZHYHBA4YNR6GLKVG5YJ42QVY5KIY6XVAA
})()

Actual results:

An incorrect file name is returned, probably an internal hash of some sort

Expected results:

The File object should have the correct file name set (test.txt)

This happens indeed and is different from Blink behavior, are we generating a random name here?

Flags: needinfo?(jvarga)
Keywords: parity-chrome
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S3

I think we need to use a different constructor here: https://searchfox.org/mozilla-central/rev/82828dba9e290914eddd294a0871533875b3a0b5/dom/fs/parent/FileSystemManagerParent.cpp#282
A constructor which also takes a name.

Flags: needinfo?(jvarga) → needinfo?(jjalkanen)
Assignee: nobody → jjalkanen
Flags: needinfo?(jjalkanen)
Attachment #9326916 - Attachment description: WIP: Bug 1825006 - Fix incorrect OPFS file names. r=#dom-storage → Bug 1825006 - Fix incorrect OPFS file names. r=#dom-storage
Attachment #9327078 - Attachment description: Bug 1825006 - Test attributes of OPFS getFile results. r=#dom-storage → Bug 1825006 - Test file names of OPFS getFile results. r=#dom-storage
Attachment #9327078 - Attachment description: Bug 1825006 - Test file names of OPFS getFile results. r=#dom-storage → Bug 1825006 - Test attributes of OPFS getFile results. r=#dom-storage
Pushed by jjalkanen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ad591d5cd205 Fix incorrect OPFS file names. r=dom-storage-reviewers,saschanaz,janv https://hg.mozilla.org/integration/autoland/rev/2e885eab12b3 Test attributes of OPFS getFile results. r=saschanaz
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/39408 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
Upstream PR merged by moz-wptsync-bot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: