From 31a00125debe45a8cdd7c4d94c7c857fafe39235 Mon Sep 17 00:00:00 2001 From: Pierre Paridans Date: Thu, 31 Aug 2023 12:54:58 +0200 Subject: [PATCH] [IMP] web,*: remove unused legacy content-disposition.js task-3439226 Part-of: odoo/odoo#133768 --- addons/mrp_subcontracting/__manifest__.py | 1 - addons/point_of_sale/__manifest__.py | 1 - addons/project/__manifest__.py | 1 - addons/web/__manifest__.py | 2 - .../src/legacy/js/libs/content-disposition.js | 247 ------------------ addons/web_editor/__manifest__.py | 1 - addons/website_slides/__manifest__.py | 1 - debian/copyright | 4 - 8 files changed, 258 deletions(-) delete mode 100644 addons/web/static/src/legacy/js/libs/content-disposition.js diff --git a/addons/mrp_subcontracting/__manifest__.py b/addons/mrp_subcontracting/__manifest__.py index cca102f2679..979ebcb28be 100644 --- a/addons/mrp_subcontracting/__manifest__.py +++ b/addons/mrp_subcontracting/__manifest__.py @@ -99,7 +99,6 @@ 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', - 'web/static/src/legacy/js/libs/content-disposition.js', 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index 45c3be7829d..8b887787d96 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -185,7 +185,6 @@ 'web/static/src/views/view_dialogs/form_view_dialog.js', 'web/static/src/views/view_dialogs/select_create_dialog.js', 'web/static/src/legacy/js/libs/download.js', - 'web/static/src/legacy/js/libs/content-disposition.js', # BEGIN copy of web.tests_assets. We don't 'include' it because other modules add their # own test helpers in this module that depend on files that they add in assets_backend 'web/static/lib/qunit/qunit-2.9.1.css', diff --git a/addons/project/__manifest__.py b/addons/project/__manifest__.py index 72ac02d32ed..06937778649 100644 --- a/addons/project/__manifest__.py +++ b/addons/project/__manifest__.py @@ -150,7 +150,6 @@ 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', - 'web/static/src/legacy/js/libs/content-disposition.js', 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 7a7b9b4b460..6dc3d3188da 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -99,7 +99,6 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', - 'web/static/src/legacy/js/libs/content-disposition.js', 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', @@ -246,7 +245,6 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', - 'web/static/src/legacy/js/libs/content-disposition.js', 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', diff --git a/addons/web/static/src/legacy/js/libs/content-disposition.js b/addons/web/static/src/legacy/js/libs/content-disposition.js deleted file mode 100644 index 102743ed709..00000000000 --- a/addons/web/static/src/legacy/js/libs/content-disposition.js +++ /dev/null @@ -1,247 +0,0 @@ -/** @odoo-module **/ -/* -(The MIT License) - -Copyright (c) 2014-2017 Douglas Christopher Wilson - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * Stripped down to only parsing/decoding. - */ - -/** - * RegExp to match percent encoding escape. - * @private - */ -var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g; - -/** - * RegExp to match non-latin1 characters. - * @private - */ -var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g; - -/** - * RegExp to match quoted-pair in RFC 2616 - * - * quoted-pair = "\" CHAR - * CHAR = - * @private - */ -var QESC_REGEXP = /\\([\u0000-\u007f])/g; - -/** - * RegExp for various RFC 2616 grammar - * - * parameter = token "=" ( token | quoted-string ) - * token = 1* - * separators = "(" | ")" | "<" | ">" | "@" - * | "," | ";" | ":" | "\" | <"> - * | "/" | "[" | "]" | "?" | "=" - * | "{" | "}" | SP | HT - * quoted-string = ( <"> *(qdtext | quoted-pair ) <"> ) - * qdtext = > - * quoted-pair = "\" CHAR - * CHAR = - * TEXT = - * LWS = [CRLF] 1*( SP | HT ) - * CRLF = CR LF - * CR = - * LF = - * SP = - * HT = - * CTL = - * OCTET = - * @private - */ -var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g; - -/** - * RegExp for various RFC 5987 grammar - * - * ext-value = charset "'" [ language ] "'" value-chars - * charset = "UTF-8" / "ISO-8859-1" / mime-charset - * mime-charset = 1*mime-charsetc - * mime-charsetc = ALPHA / DIGIT - * / "!" / "#" / "$" / "%" / "&" - * / "+" / "-" / "^" / "_" / "`" - * / "{" / "}" / "~" - * language = ( 2*3ALPHA [ extlang ] ) - * / 4ALPHA - * / 5*8ALPHA - * extlang = *3( "-" 3ALPHA ) - * value-chars = *( pct-encoded / attr-char ) - * pct-encoded = "%" HEXDIG HEXDIG - * attr-char = ALPHA / DIGIT - * / "!" / "#" / "$" / "&" / "+" / "-" / "." - * / "^" / "_" / "`" / "|" / "~" - * @private - */ -var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/; - -/** - * RegExp for various RFC 6266 grammar - * - * disposition-type = "inline" | "attachment" | disp-ext-type - * disp-ext-type = token - * disposition-parm = filename-parm | disp-ext-parm - * filename-parm = "filename" "=" value - * | "filename*" "=" ext-value - * disp-ext-parm = token "=" value - * | ext-token "=" ext-value - * ext-token = - * @private - */ -var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/; - -/** - * Decode a RFC 6987 field value (gracefully). - * - * @param {string} str - * @return {string} - * @private - */ -function decodefield(str) { - var match = EXT_VALUE_REGEXP.exec(str); - - if (!match) { - throw new TypeError('invalid extended field value') - } - - var charset = match[1].toLowerCase(); - var encoded = match[2]; - - switch (charset) { - case 'iso-8859-1': - return encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode).replace(NON_LATIN1_REGEXP, '?'); - case 'utf-8': - return decodeURIComponent(encoded); - default: - throw new TypeError('unsupported charset in extended field') - } -} - -/** - * Parse Content-Disposition header string. - * - * @param {string} string - * @return {ContentDisposition} - * @public - */ -function parse(string) { - if (!string || typeof string !== 'string') { - throw new TypeError('argument string is required') - } - - var match = DISPOSITION_TYPE_REGEXP.exec(string); - - if (!match) { - throw new TypeError('invalid type format') - } - - // normalize type - var index = match[0].length; - var type = match[1].toLowerCase(); - - var key; - var names = []; - var params = {}; - var value; - - // calculate index to start at - index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ';' ? index - 1 : index; - - // match parameters - while ((match = PARAM_REGEXP.exec(string))) { - if (match.index !== index) { - throw new TypeError('invalid parameter format') - } - - index += match[0].length; - key = match[1].toLowerCase(); - value = match[2]; - - if (names.indexOf(key) !== -1) { - throw new TypeError('invalid duplicate parameter') - } - - names.push(key); - - if (key.indexOf('*') + 1 === key.length) { - // decode extended value - key = key.slice(0, -1); - value = decodefield(value); - - // overwrite existing value - params[key] = value; - continue - } - - if (typeof params[key] === 'string') { - continue - } - - if (value[0] === '"') { - // remove quotes and escapes - value = value - .substr(1, value.length - 2) - .replace(QESC_REGEXP, '$1') - } - - params[key] = value - } - - if (index !== -1 && index !== string.length) { - throw new TypeError('invalid parameter format') - } - - return new ContentDisposition(type, params) -} - -/** - * Percent decode a single character. - * - * @param {string} str - * @param {string} hex - * @return {string} - * @private - */ -function pdecode(str, hex) { - return String.fromCharCode(parseInt(hex, 16)) -} - -/** - * Class for parsed Content-Disposition header for v8 optimization - * - * @public - * @param {string} type - * @param {object} parameters - * @constructor - */ -function ContentDisposition(type, parameters) { - this.type = type; - this.parameters = parameters -} - -export default { - parse, -}; diff --git a/addons/web_editor/__manifest__.py b/addons/web_editor/__manifest__.py index d36418cbc2a..c5bbd40ede1 100644 --- a/addons/web_editor/__manifest__.py +++ b/addons/web_editor/__manifest__.py @@ -89,7 +89,6 @@ Odoo Web Editor widget. 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', - 'web/static/src/legacy/js/libs/content-disposition.js', 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', diff --git a/addons/website_slides/__manifest__.py b/addons/website_slides/__manifest__.py index c8b9aed3dcf..3732f754ca2 100644 --- a/addons/website_slides/__manifest__.py +++ b/addons/website_slides/__manifest__.py @@ -191,7 +191,6 @@ Featuring 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/src/legacy/js/libs/autocomplete.js', 'web/static/src/legacy/js/libs/bootstrap.js', - 'web/static/src/legacy/js/libs/content-disposition.js', 'web/static/src/legacy/js/libs/download.js', 'web/static/src/legacy/js/libs/jquery.js', 'web/static/src/legacy/js/libs/moment.js', diff --git a/debian/copyright b/debian/copyright index a7462ac1ef9..7dab9fed94f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -362,10 +362,6 @@ Files: addons/web/static/src/js/core/mixins.js Copyright: 2010-2012 Jeremy Ashkenas License: MIT -Files: addons/web/static/src/js/libs/content-disposition.js -Copyright: 2014-2017 Douglas Christopher Wilson -License: MIT - Files: addons/web/static/src/js/libs/download.js Copyright: 2016 dandavis License: MIT