PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/url/index.js +23 -6 23.7.1 → 24.1.0 View file →
@@ -1,4 +1,5 @@
1 +(function() {
1 2 "use strict";
2 3 var wp;
3 4 (wp ||= {}).url = (() => {
4 5 var __create = Object.create;
@@ -728,10 +729,17 @@
728 729 }
729 730 }
730 731 function getQueryArgs(url) {
731 732 return (getQueryString(url) || "").replace(/\+/g, "%20").split("&").reduce((accumulator, keyValue) => {
732 - const [key, value = ""] = keyValue.split("=").filter(Boolean).map(safeDecodeURIComponent);
733 + const separatorIndex = keyValue.indexOf("=");
734 + const hasValue = separatorIndex !== -1;
735 + const key = safeDecodeURIComponent(
736 + hasValue ? keyValue.slice(0, separatorIndex) : keyValue
737 + );
733 738 if (key) {
739 + const value = hasValue ? safeDecodeURIComponent(
740 + keyValue.slice(separatorIndex + 1)
741 + ) : "";
734 742 const segments = key.replace(/\]/g, "").split("[");
735 743 setPath(accumulator, segments, value);
736 744 }
737 745 return accumulator;
@@ -825,9 +833,13 @@
825 833 file.slice(0, index),
826 834 file.slice(index + 1)
827 835 ];
828 836 const truncatedFile = fileName.slice(-3) + "." + extension;
829 - return file.slice(0, maxLength - truncatedFile.length - 1) + "\u2026" + truncatedFile;
837 + return (
838 + // A negative end would be read as an offset from the end of the string,
839 + // keeping most of the file name and returning more than `maxLength`.
840 + file.slice(0, Math.max(0, maxLength - truncatedFile.length - 1)) + "\u2026" + truncatedFile
841 + );
830 842 }
831 843
832 844 // packages/url/build-module/clean-for-slug.mjs
833 845 var import_remove_accents = __toESM(require_remove_accents(), 1);
@@ -854,15 +866,18 @@
854 866 }
855 867
856 868 // packages/url/build-module/normalize-path.mjs
857 869 function normalizePath(path) {
858 - const split = path.split("?");
859 - const query = split[1];
860 - const base = split[0];
870 + const separatorIndex = path.indexOf("?");
871 + if (separatorIndex === -1) {
872 + return path;
873 + }
874 + const base = path.slice(0, separatorIndex);
875 + const query = path.slice(separatorIndex + 1);
861 876 if (!query) {
862 877 return base;
863 878 }
864 - return base + "?" + query.split("&").map((entry) => entry.split("=")).map((pair) => pair.map(decodeURIComponent)).sort((a, b) => a[0].localeCompare(b[0])).map((pair) => pair.map(encodeURIComponent)).map((pair) => pair.join("=")).join("&");
879 + return base + "?" + query.split("&").map((entry) => entry.split("=")).map((pair) => pair.map(safeDecodeURIComponent)).sort((a, b) => a[0].localeCompare(b[0])).map((pair) => pair.map(encodeURIComponent)).map((pair) => pair.join("=")).join("&");
865 880 }
866 881
867 882 // packages/url/build-module/prepend-https.mjs
868 883 function prependHTTPS(url) {
@@ -875,6 +890,8 @@
875 890 url = prependHTTP(url);
876 891 return url.replace(/^http:/, "https:");
877 892 }
878 893 return __toCommonJS(index_exports);
894 +})();
895 +(window.wp ||= {}).url = wp.url;
879 896 })();
880 897 //# sourceMappingURL=index.js.map