From 54b1cbe5e1b2bca756cfbe72791a1ae5cf47f515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Gabriel=20S=C3=A1nchez?= Date: Thu, 13 Oct 2016 11:47:40 -0300 Subject: [PATCH 1/3] Fix when using Data URIs for the manifest --- lib/net/data_uri_plugin.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/net/data_uri_plugin.js b/lib/net/data_uri_plugin.js index e54b1bb91a..dc898d65d3 100644 --- a/lib/net/data_uri_plugin.js +++ b/lib/net/data_uri_plugin.js @@ -79,7 +79,14 @@ shaka.net.DataUriPlugin = function(uri, request) { } /** @type {shakaExtern.Response} */ - var response = {uri: uri, data: data, headers: {}}; + var response = { + uri: uri, + data: data, + headers: { + 'content-type': typeAndEncoding[0] + } + }; + resolve(response); }); }; From 3009bf7c65649a603faa999c8af51dec62217a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Gabriel=20S=C3=A1nchez?= Date: Thu, 13 Oct 2016 12:11:51 -0300 Subject: [PATCH 2/3] added me to AUTHORS and CONTRIBUTORS --- AUTHORS | 1 + CONTRIBUTORS | 1 + 2 files changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 047547b571..01cba3fa09 100644 --- a/AUTHORS +++ b/AUTHORS @@ -20,6 +20,7 @@ Jason Palmer Jesper Haug Karsrud Johan Sundström JW Player <*@jwplayer.com> +Lucas Gabriel Sánchez Mattias Wadman Nick Desaulniers Oskar Arvidsson diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 496151ba18..252c15de9b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -33,6 +33,7 @@ Jesper Haug Karsrud Joey Parrish Johan Sundström Jono Ward +Lucas Gabriel Sánchez Mattias Wadman Natalie Harris Nick Desaulniers From 17350cfa1b53a245e8b516df7e3326fb10ff8c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20G=2E=20S=C3=A1nchez?= Date: Mon, 17 Oct 2016 09:53:52 -0300 Subject: [PATCH 3/3] update test/net/data_uri_plugin_unit.js to test Data URIs content-type header response --- test/net/data_uri_plugin_unit.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/net/data_uri_plugin_unit.js b/test/net/data_uri_plugin_unit.js index 84aff55ab5..92800f87d7 100644 --- a/test/net/data_uri_plugin_unit.js +++ b/test/net/data_uri_plugin_unit.js @@ -23,31 +23,32 @@ describe('DataUriPlugin', function() { }); it('supports MIME types', function(done) { - testSucceeds('data:text/plain,Hello', 'Hello', done); + testSucceeds('data:text/plain,Hello', 'text/plain', 'Hello', done); }); it('supports URI encoded text', function(done) { testSucceeds( 'data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E', + 'text/html', '

Hello, World!

', done); }); it('supports base64 encoded text', function(done) { testSucceeds( - 'data:;base64,SGVsbG8sIFdvcmxkIQ%3D%3D', 'Hello, World!', done); + 'data:;base64,SGVsbG8sIFdvcmxkIQ%3D%3D', '', 'Hello, World!', done); }); it('supports extra colin', function(done) { - testSucceeds('data:,Hello:', 'Hello:', done); + testSucceeds('data:,Hello:', '', 'Hello:', done); }); it('supports extra semi-colin', function(done) { - testSucceeds('data:,Hello;', 'Hello;', done); + testSucceeds('data:,Hello;', '', 'Hello;', done); }); it('supports extra comma', function(done) { - testSucceeds('data:,Hello,', 'Hello,', done); + testSucceeds('data:,Hello,', '', 'Hello,', done); }); it('fails for empty URI', function(done) { @@ -67,7 +68,7 @@ describe('DataUriPlugin', function() { testFails('data:Bad', done, shaka.util.Error.Code.MALFORMED_DATA_URI); }); - function testSucceeds(uri, text, done) { + function testSucceeds(uri, contentType, text, done) { var request = shaka.net.NetworkingEngine.makeRequest([uri], retryParameters); shaka.net.DataUriPlugin(uri, request) @@ -75,6 +76,7 @@ describe('DataUriPlugin', function() { expect(response).toBeTruthy(); expect(response.uri).toBe(uri); expect(response.data).toBeTruthy(); + expect(response.headers['content-type']).toBe(contentType); var data = shaka.util.StringUtils.fromBytesAutoDetect(response.data); expect(data).toBe(text); })