Commit 51373c4e authored by Joey Arhar's avatar Joey Arhar Committed by Commit Bot

Add xls and xlsx mime types to mime_util

The mime types for xls and xlsx are listed on MDN[1] and on iana.org[2].

[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
[2] https://www.iana.org/assignments/media-types/media-types.xhtml

Although the OS mime type <-> file extension mapping usually gets
xls/xlsx for us, it appears that in some cases and on some users
machines it doesn't happen. The reporter of this bug had it happen on
their mac, and the windows cq+1 trybot fails the test without the patch.

Bug: 1132791
Change-Id: I4fc35bc3387d98b5967d0a476788b32bf6e2c6f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2462664Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816688}
parent 2a145336
...@@ -194,6 +194,9 @@ static const MimeInfo kSecondaryMappings[] = { ...@@ -194,6 +194,9 @@ static const MimeInfo kSecondaryMappings[] = {
{"application/rss+xml", "rss"}, {"application/rss+xml", "rss"},
{"application/vnd.android.package-archive", "apk"}, {"application/vnd.android.package-archive", "apk"},
{"application/vnd.mozilla.xul+xml", "xul"}, {"application/vnd.mozilla.xul+xml", "xul"},
{"application/vnd.ms-excel", "xls"},
{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"xlsx"},
{"application/x-gzip", "gz,tgz"}, {"application/x-gzip", "gz,tgz"},
{"application/x-mpegurl", "m3u8"}, {"application/x-mpegurl", "m3u8"},
{"application/x-shockwave-flash", "swf,swl"}, {"application/x-shockwave-flash", "swf,swl"},
......
<!DOCTYPE html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<iframe id="formiframe" name="formiframe"></iframe>
<form target="formiframe" id="myform" action="/forms/resources/return-content-type.php" enctype="multipart/form-data" method="post">
<input type="text" name="textinput" value="hello world">
<input type="file" name="fileinput" id="fileinput">
<input type="submit">
</form>
<script>
window.test(() => {
if (!window.eventSender)
return;
const fileinput = document.getElementById('fileinput');
window.eventSender.beginDragWithFiles(['resources/hello_world.xls']);
const centerx = fileinput.offsetLeft + fileinput.offsetWidth / 2;
const centery = fileinput.offsetTop + fileinput.offsetHeight / 2;
window.eventSender.mouseMoveTo(centerx, centery);
window.eventSender.mouseUp();
assert_equals(fileinput.files[0].type, 'application/vnd.ms-excel');
});
</script>
</body>
<!DOCTYPE html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<iframe id="formiframe" name="formiframe"></iframe>
<form target="formiframe" id="myform" action="/forms/resources/return-content-type.php" enctype="multipart/form-data" method="post">
<input type="text" name="textinput" value="hello world">
<input type="file" name="fileinput" id="fileinput">
<input type="submit">
</form>
<script>
window.test(() => {
if (!window.eventSender)
return;
const fileinput = document.getElementById('fileinput');
window.eventSender.beginDragWithFiles(['resources/hello_world.xlsx']);
const centerx = fileinput.offsetLeft + fileinput.offsetWidth / 2;
const centery = fileinput.offsetTop + fileinput.offsetHeight / 2;
window.eventSender.mouseMoveTo(centerx, centery);
window.eventSender.mouseUp();
assert_equals(fileinput.files[0].type, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
});
</script>
</body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment