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 +20 -6 23.8.0 → 24.1.0 View file →
@@ -729,10 +729,17 @@
729 729 }
730 730 }
731 731 function getQueryArgs(url) {
732 732 return (getQueryString(url) || "").replace(/\+/g, "%20").split("&").reduce((accumulator, keyValue) => {
733 - 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 + );
734 738 if (key) {
739 + const value = hasValue ? safeDecodeURIComponent(
740 + keyValue.slice(separatorIndex + 1)
741 + ) : "";
735 742 const segments = key.replace(/\]/g, "").split("[");
736 743 setPath(accumulator, segments, value);
737 744 }
738 745 return accumulator;
@@ -826,9 +833,13 @@
826 833 file.slice(0, index),
827 834 file.slice(index + 1)
828 835 ];
829 836 const truncatedFile = fileName.slice(-3) + "." + extension;
830 - 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 + );
831 842 }
832 843
833 844 // packages/url/build-module/clean-for-slug.mjs
834 845 var import_remove_accents = __toESM(require_remove_accents(), 1);
@@ -855,15 +866,18 @@
855 866 }
856 867
857 868 // packages/url/build-module/normalize-path.mjs
858 869 function normalizePath(path) {
859 - const split = path.split("?");
860 - const query = split[1];
861 - 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);
862 876 if (!query) {
863 877 return base;
864 878 }
865 - 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("&");
866 880 }
867 881
868 882 // packages/url/build-module/prepend-https.mjs
869 883 function prependHTTPS(url) {