Bug 907428 - Include the file path in the 'filename' field in the MIME headers for files in multipart form submissions. r=sicking
authorJonathan Watt <jwatt@jwatt.org>
Fri, 23 Aug 2013 08:44:11 +0100
changeset 145236 068c13777f4d3a082804ead9a417d3636c212f36
parent 145235 e5e6c3bb26b359ddd0c02a37a6f992e2b3cbaf09
child 145237 f66ac3e480caffa9a112a4b9b5294250ac0f0d1e
push id33204
push userjwatt@jwatt.org
push dateMon, 02 Sep 2013 14:21:37 +0000
treeherdermozilla-inbound@068c13777f4d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs907428
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 907428 - Include the file path in the 'filename' field in the MIME headers for files in multipart form submissions. r=sicking
content/html/content/src/nsFormSubmission.cpp
--- a/content/html/content/src/nsFormSubmission.cpp
+++ b/content/html/content/src/nsFormSubmission.cpp
@@ -465,16 +465,23 @@ nsFSMultipartFormData::AddNameFilePair(c
       nsCOMPtr<nsIDOMFile> file = do_QueryInterface(aBlob);
       if (file) {
         rv = file->GetName(filename16);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       if (filename16.IsEmpty()) {
         filename16.AssignLiteral("blob");
+      } else {
+        nsAutoString filepath16;
+        rv = file->GetPath(filepath16);
+        NS_ENSURE_SUCCESS(rv, rv);
+        if (!filepath16.IsEmpty()) {
+          filename16 = filepath16 + NS_LITERAL_STRING("/") + filename16;
+        }
       }
 
       rv = EncodeVal(filename16, filename, true);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     // Get content type
     nsAutoString contentType16;