Closed Bug 858996 Opened 12 years ago Closed 12 years ago

Cannot open file contain '~' in file name via DeviceStorage API

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 845707
1.1 QE1 (5may)

People

(Reporter: leo.bugzilla.gecko, Unassigned)

Details

When I push attached video clip in the device, video application can retrieve thumbnail. However, if I try to play the contents, it cannot play the clip. nsresult nsHTMLMediaElement::InitializeDecoderForChannel(nsIChannel *aChannel, nsIStreamListener **aListener) { aChannel->GetContentType(mMimeType); <==== this function returns strange mimetype. } It returns mimetype of "text/html" I think this problem is related to file name of the video clip. And there's log like this. 01-07 22:14:39.009 E 459 GeckoConsole Content JS ERROR at app://video.gaiamobile.org/gaia_build_defer_index.js:140 in anonymous: MediaDB.getFile: SecurityError
I cannot attach file. (Becuase file name is the problem) Please check this issue with any file that's renamed like this ")(&%$#@!~_+-=.png.mp4"
blocking-b2g: --- → leo?
Triage 4/10 - Leo- base on comment 1, a weird file name would cause this. Which should not be a proper use case. Tim, can you suggest someone that can check this issue?
blocking-b2g: leo? → ---
tracking-b2g18: --- → ?
Flags: needinfo?(timdream)
Web content has nothing to do with mine-type. Logic in Gecko must have been cause this issue.
Component: Gaia::Video → General
Flags: needinfo?(timdream)
If I recall correctly, we sniff the content type based on the file data instead of the file name so unless the data is incorrect we shouldn't get "text/html".
Flags: needinfo?(paul)
Yes, we do. Please upload the file somewhere so I can check what is going on here.
Flags: needinfo?(paul)
Using any mp4 video and rename it to ")(&%$#@!~_+-=.png.mp4" will reproduce this bug. The mimetype |text/html| is generated for about:blank, not for the video file. It's most likely that we are not encoding the URL for the special file path correctly. Here is the actual error log: > E/GeckoConsole( 1300): [JavaScript Warning: "HTTP "Content-Type" of "text/html" is not supported. Load of media resource about:blank failed." {file: "app://video.gaiamobile.org/index.html" line: 0}]
Urh, let's forget about the JS warning about Content-Type, this warning is actually pop-up at the first time you initiate the video player. > E/GeckoConsole( 1300): Content JS ERROR at app://video.gaiamobile.org/shared/js/mediadb.js:594 in getFile/getRequest.onerror: MediaDB.getFile: SecurityError The special file name contains the '~' character which will be concider as an unsafe file path in DeviceStorage, therefore an permission denied error will be raised. http://dxr.mozilla.org/mozilla-central/dom/devicestorage/nsDeviceStorage.cpp#l2026
The real issue here is that DeviceStorage cannot open a file which DeviceStorage reported to app previously. We should either allow the file open operation or not report its existance.
Summary: [A/V] Wrong mimetype of attached video clip → Cannot open file contain '~' in file name via DeviceStorage API
Dupe.
Status: NEW → RESOLVED
Closed: 12 years ago
tracking-b2g18: ? → ---
Resolution: --- → DUPLICATE
Because leo? tag is removed from the bug 845707, I reopened this issue. If you think this problem is not blocking issue, I want to solve this problem by another way. This issue leads two problem on the device. 1. Video thumbnail is shown on video app but it cannot be played. (music and gallery application have same problem) 2. Since video application doesn't consider errors, device freezed after trying to play these kind of video clip. So I think, those application should not list up the contents that have '~' character in its file name.
Status: RESOLVED → REOPENED
blocking-b2g: --- → leo?
Resolution: DUPLICATE → ---
If there is no leo? tag on the other bug, the nom the dupe. But don't duplicate both as one being a nom and the other not being. There's discussion in the other bug as for why this was marked as a tracking-.
Status: REOPENED → RESOLVED
blocking-b2g: leo? → ---
Closed: 12 years ago12 years ago
Resolution: --- → DUPLICATE
Target Milestone: --- → Leo QE1 (5may)
Assignee: nobody → kchen
Assignee: kchen → nobody
You need to log in before you can comment on or make changes to this bug.