summaryrefslogtreecommitdiffstats
path: root/vendor/ammonia
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ammonia')
-rw-r--r--vendor/ammonia/.cargo-checksum.json2
-rw-r--r--vendor/ammonia/CHANGELOG.md11
-rw-r--r--vendor/ammonia/Cargo.lock518
-rw-r--r--vendor/ammonia/Cargo.toml18
-rw-r--r--vendor/ammonia/LICENSE-MIT2
-rw-r--r--vendor/ammonia/README.md2
-rw-r--r--vendor/ammonia/src/lib.rs328
-rw-r--r--vendor/ammonia/src/rcdom.rs38
8 files changed, 630 insertions, 289 deletions
diff --git a/vendor/ammonia/.cargo-checksum.json b/vendor/ammonia/.cargo-checksum.json
index c2a6cb27d..a33ac6d2d 100644
--- a/vendor/ammonia/.cargo-checksum.json
+++ b/vendor/ammonia/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"424accda5fd8607826f81db9f88debda74caf9cb2bbc8f20bea25aeaccf7d515","CODE_OF_CONDUCT.md":"58043b883e086791ab688b87fd7f692ae0176727fb02957781ba2f25a5a199a1","Cargo.lock":"c377d4b4c8e2f560378070a4db592904dbec5ce0a5fce64dca6817e25e505840","Cargo.toml":"774628570e94a319e55eb51564698daf4c8c914a1966a429d52a58727647594d","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"565c516359bc84cc469a1b51dd59df60071bc23587ec5b59397ee71bb8e5cff8","README.md":"ce3b5e1a04fc604ce343e5f27ce3201610ca76e85b3a565143c0f228406668a0","RELEASE_PROCESS.md":"c06c0322b7f0d766a2f5dce08c53f9e9704b45f46b445521abca4b4c819d21b9","SECURITY.md":"206ccf40ec6aa34055f6da99366829a330f3b3189dbd2b79feace15f8524edc3","bors.toml":"542f9ce988ed5553cae00ab93d36cba550de73762e54b7865263cb24ba42af2e","examples/ammonia-cat.rs":"94c3fa92816a58ef9f8f7d5b0babb3778bedb5fba02e538c208eae0b1bf0b681","src/lib.rs":"75d544ac15fddd962ebd8667bf5e2709d2bc38782115ffc42f9203d83efdd53f","src/rcdom.rs":"e80bd9aca18875dfac99af94a4edaac4606ea8c57c90400592399974ddb86c26","tests/version-numbers.rs":"7711bb7de089a67efd19134f7af6a86c3422ed314da6ddbcab71c987eac2ad8b"},"package":"d5ed2509ee88cc023cccee37a6fab35826830fe8b748b3869790e7720c2c4a74"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"7bbe618e435bd74e2322007329a2bb448c18f1daee8f2e0dbd5e01c6317042bc","CODE_OF_CONDUCT.md":"58043b883e086791ab688b87fd7f692ae0176727fb02957781ba2f25a5a199a1","Cargo.lock":"f564b51ec5040e5b8a51247d0005295de25a11b4cfbb725492451d7d13f9c05d","Cargo.toml":"a5027aaf22e799f0f7c9631eb82f226c962bff017c4df47a94c2b2f25badd0fc","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"6ced8d1b9d96dae227bb1b31876359bbd089d8c18378e4e42eb45b84f29e9ae9","README.md":"cbefe606ab8e1e216e24b22788abc25bcb7d749478be845f2881316042a14388","RELEASE_PROCESS.md":"c06c0322b7f0d766a2f5dce08c53f9e9704b45f46b445521abca4b4c819d21b9","SECURITY.md":"206ccf40ec6aa34055f6da99366829a330f3b3189dbd2b79feace15f8524edc3","bors.toml":"542f9ce988ed5553cae00ab93d36cba550de73762e54b7865263cb24ba42af2e","examples/ammonia-cat.rs":"94c3fa92816a58ef9f8f7d5b0babb3778bedb5fba02e538c208eae0b1bf0b681","src/lib.rs":"7926755f77b2693cef1524ddaeb656f4494afcfec2407489f4ad7f06f1054ee9","src/rcdom.rs":"6635ce79b6e6e1c959c03a7dbd643d91163084bcb19c8290658c0cbbf9891274","tests/version-numbers.rs":"7711bb7de089a67efd19134f7af6a86c3422ed314da6ddbcab71c987eac2ad8b"},"package":"64e6d1c7838db705c9b756557ee27c384ce695a1c51a6fe528784cb1c6840170"} \ No newline at end of file
diff --git a/vendor/ammonia/CHANGELOG.md b/vendor/ammonia/CHANGELOG.md
index b4d5c0cad..ad4b6b40d 100644
--- a/vendor/ammonia/CHANGELOG.md
+++ b/vendor/ammonia/CHANGELOG.md
@@ -1,5 +1,16 @@
# Unreleased
+# 3.3.0
+
+* chore: bump MSRV to 1.60.0
+* docs: fix incorrect XSS example
+* feature: add `UrlRelative::RewriteWithRoot`
+
+# 3.2.1
+
+* chore: bump MSRV to 1.51.0 <https://github.com/serde-rs/serde/issues/2255>
+* chore: fix broken links in documentation
+
# 3.2.0
* chore: bump MSRV to 1.49.0
diff --git a/vendor/ammonia/Cargo.lock b/vendor/ammonia/Cargo.lock
index 78f0e3a1e..b6997c4b2 100644
--- a/vendor/ammonia/Cargo.lock
+++ b/vendor/ammonia/Cargo.lock
@@ -4,16 +4,16 @@ version = 3
[[package]]
name = "aho-corasick"
-version = "0.7.18"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
+checksum = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
dependencies = [
"memchr",
]
[[package]]
name = "ammonia"
-version = "3.2.0"
+version = "3.3.0"
dependencies = [
"env_logger",
"html5ever",
@@ -25,55 +25,71 @@ dependencies = [
]
[[package]]
-name = "atty"
-version = "0.2.14"
+name = "autocfg"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
-]
+checksum = "23213af7601f0f2d929f73d2a772804562cb09063f50bba9c361f86d6a0376f8"
[[package]]
-name = "autocfg"
-version = "1.1.0"
+name = "bitflags"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
-name = "bitflags"
-version = "1.3.2"
+name = "c2-chacha"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+checksum = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101"
+dependencies = [
+ "lazy_static",
+ "ppv-lite86",
+]
[[package]]
name = "cfg-if"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
+
+[[package]]
+name = "either"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+checksum = "5845bf77d497f79416df39462df26d4a8b71dd6440246848ee63709476dbb9a6"
[[package]]
name = "env_logger"
-version = "0.9.0"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
+checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
dependencies = [
- "atty",
"humantime",
+ "is-terminal",
"log",
"regex",
"termcolor",
]
[[package]]
-name = "form_urlencoded"
-version = "1.0.1"
+name = "errno"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
+checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
- "matches",
- "percent-encoding",
+ "errno-dragonfly",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "errno-dragonfly"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
+dependencies = [
+ "gcc",
+ "libc",
]
[[package]]
@@ -87,10 +103,26 @@ dependencies = [
]
[[package]]
+name = "gcc"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b77be93ea1c17c98001d9f3837c3034505ec875eb2e681968fa73cdfb98b93f6"
+
+[[package]]
+name = "getrandom"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cd8e190892c840661957ba9f32dacfb3eb405e657f9f9f60485605f0bb37d6f8"
+dependencies = [
+ "cfg-if",
+ "libc",
+]
+
+[[package]]
name = "getrandom"
-version = "0.2.6"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
+checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"
dependencies = [
"cfg-if",
"libc",
@@ -99,9 +131,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
-version = "0.1.19"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
+checksum = "1ab7905ea95c6d9af62940f9d7dd9596d54c334ae2c15300c482051292d5637f"
dependencies = [
"libc",
]
@@ -122,15 +154,15 @@ dependencies = [
[[package]]
name = "humantime"
-version = "2.1.0"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
+checksum = "b9b6c53306532d3c8e8087b44e6580e10db51a023cf9b433cea2ac38066b92da"
[[package]]
name = "idna"
-version = "0.2.3"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
+checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
dependencies = [
"matches",
"unicode-bidi",
@@ -138,41 +170,74 @@ dependencies = [
]
[[package]]
-name = "libc"
-version = "0.2.121"
+name = "io-lifetimes"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
+checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
+dependencies = [
+ "libc",
+ "windows-sys",
+]
[[package]]
-name = "lock_api"
-version = "0.4.7"
+name = "is-terminal"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
+checksum = "aae5bc6e2eb41c9def29a3e0f1306382807764b9b53112030eff57435667352d"
dependencies = [
- "autocfg",
- "scopeguard",
+ "hermit-abi",
+ "io-lifetimes",
+ "rustix",
+ "windows-sys",
+]
+
+[[package]]
+name = "itertools"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
+dependencies = [
+ "either",
]
[[package]]
+name = "lazy_static"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
+
+[[package]]
+name = "libc"
+version = "0.2.133"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb68f22743a3fb35785f1e7f844ca5a3de2dde5bd0c0ef5b372065814699b121"
+
+[[package]]
name = "log"
-version = "0.4.16"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
+checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
dependencies = [
"cfg-if",
]
[[package]]
name = "mac"
-version = "0.1.1"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
+checksum = "e1c0277230392980e54a65b765117d299b40b529068ece39b12adde0f95c6da0"
[[package]]
name = "maplit"
-version = "1.0.2"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
+checksum = "5ed95049d40b8a1a7691adbabca028ad481f7e6a2921ce4846e1ee168b4e4ca5"
[[package]]
name = "markup5ever"
@@ -190,21 +255,21 @@ dependencies = [
[[package]]
name = "matches"
-version = "0.1.9"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
+checksum = "15305656809ce5a4805b1ff2946892810992197ce1270ff79baded852187942e"
[[package]]
name = "memchr"
-version = "2.4.1"
+version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
+checksum = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223"
[[package]]
name = "new_debug_unreachable"
-version = "1.0.4"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
+checksum = "fe2deb65e9f08f6540e6766481b9dc3a36e73d2fdb96e82bc3cd56353fafe90a"
[[package]]
name = "once_cell"
@@ -213,61 +278,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]]
-name = "parking_lot"
-version = "0.12.0"
+name = "percent-encoding"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
-dependencies = [
- "lock_api",
- "parking_lot_core",
-]
+checksum = "ba4f28a6faf4ffea762ba8f4baef48c61a6db348647c73095034041fc79dd954"
[[package]]
-name = "parking_lot_core"
-version = "0.9.2"
+name = "phf"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37"
+checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f"
dependencies = [
- "cfg-if",
- "libc",
- "redox_syscall",
- "smallvec",
- "windows-sys",
+ "phf_shared 0.10.0",
]
[[package]]
-name = "percent-encoding"
-version = "2.1.0"
+name = "phf_codegen"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
+checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
+dependencies = [
+ "phf_generator 0.10.0",
+ "phf_shared 0.10.0",
+]
[[package]]
-name = "phf"
-version = "0.10.1"
+name = "phf_generator"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"
+checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
dependencies = [
- "phf_shared",
+ "phf_shared 0.8.0",
+ "rand 0.7.0",
]
[[package]]
-name = "phf_codegen"
+name = "phf_generator"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd"
+checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
dependencies = [
- "phf_generator",
- "phf_shared",
+ "phf_shared 0.10.0",
+ "rand 0.8.0",
]
[[package]]
-name = "phf_generator"
-version = "0.10.0"
+name = "phf_shared"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6"
+checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
dependencies = [
- "phf_shared",
- "rand",
+ "siphasher",
]
[[package]]
@@ -281,30 +342,30 @@ dependencies = [
[[package]]
name = "ppv-lite86"
-version = "0.2.16"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
+checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
[[package]]
name = "precomputed-hash"
-version = "0.1.1"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
+checksum = "cdf1fc3616b3ef726a847f2cd2388c646ef6a1f1ba4835c2629004da48184150"
[[package]]
name = "proc-macro2"
-version = "1.0.36"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
+checksum = "19f287c234c9b2d0308d692dee5c449c1a171167a6f8150f7cf2a49d8fd96967"
dependencies = [
"unicode-xid",
]
[[package]]
name = "pulldown-cmark"
-version = "0.8.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8"
+checksum = "2c2d7fd131800e0d63df52aff46201acaab70b431a4a1ec6f0343fe8e64f35a4"
dependencies = [
"bitflags",
"memchr",
@@ -313,130 +374,186 @@ dependencies = [
[[package]]
name = "quote"
-version = "1.0.17"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58"
+checksum = "7ab938ebe6f1c82426b5fb82eaf10c3e3028c53deaa3fbe38f5904b37cf4d767"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
-version = "0.8.5"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c"
+dependencies = [
+ "getrandom 0.1.7",
+ "libc",
+ "rand_chacha 0.2.0",
+ "rand_core 0.5.0",
+ "rand_hc 0.2.0",
+ "rand_pcg",
+]
+
+[[package]]
+name = "rand"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+checksum = "a76330fb486679b4ace3670f117bbc9e16204005c4bde9c4bd372f45bed34f12"
dependencies = [
"libc",
- "rand_chacha",
- "rand_core",
+ "rand_chacha 0.3.0",
+ "rand_core 0.6.2",
+ "rand_hc 0.3.0",
]
[[package]]
name = "rand_chacha"
-version = "0.3.1"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+checksum = "e193067942ef6f485a349a113329140d0ab9e2168ce92274499bb0e9a4190d9d"
+dependencies = [
+ "autocfg",
+ "c2-chacha",
+ "rand_core 0.5.0",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [
"ppv-lite86",
- "rand_core",
+ "rand_core 0.6.2",
]
[[package]]
name = "rand_core"
-version = "0.6.3"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
+checksum = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca"
dependencies = [
- "getrandom",
+ "getrandom 0.1.7",
]
[[package]]
-name = "redox_syscall"
-version = "0.2.13"
+name = "rand_core"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
+checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
dependencies = [
- "bitflags",
+ "getrandom 0.2.0",
+]
+
+[[package]]
+name = "rand_hc"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
+dependencies = [
+ "rand_core 0.5.0",
+]
+
+[[package]]
+name = "rand_hc"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
+dependencies = [
+ "rand_core 0.6.2",
+]
+
+[[package]]
+name = "rand_pcg"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3e196346cbbc5c70c77e7b4926147ee8e383a38ee4d15d58a08098b169e492b6"
+dependencies = [
+ "autocfg",
+ "rand_core 0.5.0",
]
[[package]]
name = "regex"
-version = "1.5.5"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
+checksum = "fc98360d9e6ad383647702acc90f80b0582eac3ea577ab47d96325d3575de908"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
+ "thread_local",
]
[[package]]
name = "regex-syntax"
-version = "0.6.25"
+version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
+checksum = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
[[package]]
-name = "scopeguard"
-version = "1.1.0"
+name = "rustix"
+version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
+checksum = "ce726fa480ae3aa26c84a43e524fee49ba760c3d40596e162319507152b445a0"
+dependencies = [
+ "bitflags",
+ "errno",
+ "io-lifetimes",
+ "libc",
+ "linux-raw-sys",
+ "windows-sys",
+]
[[package]]
-name = "semver"
-version = "1.0.7"
+name = "semver-parser"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4"
+checksum = "b46e1121e8180c12ff69a742aabc4f310542b6ccb69f1691689ac17fdf8618aa"
[[package]]
name = "serde"
-version = "1.0.136"
+version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
+checksum = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72"
[[package]]
name = "siphasher"
-version = "0.3.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
-
-[[package]]
-name = "smallvec"
-version = "1.8.0"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
+checksum = "9913c75df657d84a03fa689c016b0bb2863ff0b497b26a8d6e9703f8d5df03a8"
[[package]]
name = "string_cache"
-version = "0.8.4"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08"
+checksum = "2940c75beb4e3bf3a494cef919a747a2cb81e52571e212bfbd185074add7208a"
dependencies = [
+ "lazy_static",
"new_debug_unreachable",
- "once_cell",
- "parking_lot",
- "phf_shared",
+ "phf_shared 0.8.0",
"precomputed-hash",
"serde",
]
[[package]]
name = "string_cache_codegen"
-version = "0.5.2"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988"
+checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97"
dependencies = [
- "phf_generator",
- "phf_shared",
+ "phf_generator 0.8.0",
+ "phf_shared 0.8.0",
"proc-macro2",
"quote",
]
[[package]]
name = "syn"
-version = "1.0.90"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f"
+checksum = "9f8c8eab7d9f493cd89d4068085651d81ac7d39c56eb64f7158ea514b156e280"
dependencies = [
"proc-macro2",
"quote",
@@ -445,9 +562,9 @@ dependencies = [
[[package]]
name = "tendril"
-version = "0.4.3"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0"
+checksum = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508"
dependencies = [
"futf",
"mac",
@@ -456,33 +573,27 @@ dependencies = [
[[package]]
name = "termcolor"
-version = "1.1.3"
+version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
+checksum = "bf11676eb135389f21fcda654382c4859bbfc1d2f36e4425a2f829bb41b1e20e"
dependencies = [
"winapi-util",
]
[[package]]
-name = "tinyvec"
-version = "1.5.1"
+name = "thread_local"
+version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
+checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
dependencies = [
- "tinyvec_macros",
+ "lazy_static",
]
[[package]]
-name = "tinyvec_macros"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
-
-[[package]]
name = "toml"
-version = "0.5.8"
+version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
+checksum = "a54ae44b0b2c443e7ef6dd3be16a776bae4daa40684f81e15126bc04e7747308"
dependencies = [
"serde",
]
@@ -498,32 +609,31 @@ dependencies = [
[[package]]
name = "unicode-bidi"
-version = "0.3.7"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
+checksum = "2560b941fdb9ea38301b9b708504d612fcdf9c91a8c31d82219bd74cb07d304d"
+dependencies = [
+ "matches",
+]
[[package]]
name = "unicode-normalization"
-version = "0.1.19"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
-dependencies = [
- "tinyvec",
-]
+checksum = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
[[package]]
name = "unicode-xid"
-version = "0.2.2"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "url"
-version = "2.2.2"
+version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
+checksum = "77ddaf52e65c6b81c56b7e957c0b1970f7937f21c5c6774c4e56fcb4e20b48c6"
dependencies = [
- "form_urlencoded",
"idna",
"matches",
"percent-encoding",
@@ -531,20 +641,24 @@ dependencies = [
[[package]]
name = "utf-8"
-version = "0.7.6"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
+checksum = "9d58461479716ff2ba870f62c8eae9a03d93716b021401965fc095539fb0570a"
+dependencies = [
+ "matches",
+]
[[package]]
name = "version-sync"
-version = "0.9.4"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99d0801cec07737d88cb900e6419f6f68733867f90b3faaa837e84692e101bf0"
+checksum = "382f6877399646e1b88f4b89813b4577147fa924464317378eb39c280d1e9e4c"
dependencies = [
+ "itertools",
"proc-macro2",
"pulldown-cmark",
"regex",
- "semver",
+ "semver-parser",
"syn",
"toml",
"url",
@@ -558,15 +672,15 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasi"
-version = "0.10.2+wasi-snapshot-preview1"
+version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
+checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "winapi"
-version = "0.3.9"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+checksum = "b3ad91d846a4a5342c1fb7008d26124ee6cf94a3953751618577295373b32117"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
@@ -574,64 +688,78 @@ dependencies = [
[[package]]
name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+checksum = "a16a8e2ebfc883e2b1771c6482b1fb3c6831eab289ba391619a2d93a7356220f"
[[package]]
name = "winapi-util"
-version = "0.1.5"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+checksum = "8ca29cb03c8ceaf20f8224a18a530938305e9872b1478ea24ff44b4f503a1d1d"
[[package]]
name = "windows-sys"
-version = "0.34.0"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825"
+checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
+ "windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
+
+[[package]]
name = "windows_aarch64_msvc"
-version = "0.34.0"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d"
+checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
-version = "0.34.0"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed"
+checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
-version = "0.34.0"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956"
+checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.34.0"
+version = "0.42.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4"
+checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.34.0"
+version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9"
+checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
diff --git a/vendor/ammonia/Cargo.toml b/vendor/ammonia/Cargo.toml
index f54f76166..7c1735262 100644
--- a/vendor/ammonia/Cargo.toml
+++ b/vendor/ammonia/Cargo.toml
@@ -12,15 +12,24 @@
[package]
edition = "2018"
name = "ammonia"
-version = "3.2.0"
+version = "3.3.0"
authors = ["Michael Howell <michael@notriddle.com>"]
description = "HTML Sanitization"
documentation = "https://docs.rs/ammonia/"
readme = "README.md"
-keywords = ["sanitization", "html", "security", "xss"]
-categories = ["web-programming", "text-processing"]
+keywords = [
+ "sanitization",
+ "html",
+ "security",
+ "xss",
+]
+categories = [
+ "web-programming",
+ "text-processing",
+]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-ammonia/ammonia"
+
[dependencies.html5ever]
version = "0.26"
@@ -35,8 +44,9 @@ version = "0.4"
[dependencies.url]
version = "2"
+
[dev-dependencies.env_logger]
-version = "0.9"
+version = "0.10"
[dev-dependencies.version-sync]
version = "0.9"
diff --git a/vendor/ammonia/LICENSE-MIT b/vendor/ammonia/LICENSE-MIT
index 2af1161b7..7d0571e2a 100644
--- a/vendor/ammonia/LICENSE-MIT
+++ b/vendor/ammonia/LICENSE-MIT
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2021 The ammonia Developers
+Copyright (c) 2015-2022 The ammonia Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/vendor/ammonia/README.md b/vendor/ammonia/README.md
index d7e22541e..3e6c359c2 100644
--- a/vendor/ammonia/README.md
+++ b/vendor/ammonia/README.md
@@ -2,7 +2,7 @@ HTML Sanitization
=================
[![Crates.IO](https://img.shields.io/crates/v/ammonia.svg)](https://crates.rs/crates/ammonia)
-![Requires rustc 1.49.0](https://img.shields.io/badge/rustc-1.49.0+-green.svg)
+![Requires rustc 1.60.0](https://img.shields.io/badge/rustc-1.60.0+-green.svg)
Ammonia is a whitelist-based HTML sanitization library. It is designed to
prevent cross-site scripting, layout breaking, and clickjacking caused
diff --git a/vendor/ammonia/src/lib.rs b/vendor/ammonia/src/lib.rs
index d80d66ac7..3928219cc 100644
--- a/vendor/ammonia/src/lib.rs
+++ b/vendor/ammonia/src/lib.rs
@@ -19,7 +19,7 @@
//!
//! ```
//! let result = ammonia::clean(
-//! "<b><img src='' onerror='alert(\\'hax\\')'>I'm not trying to XSS you</b>"
+//! "<b><img src='' onerror=alert('hax')>I'm not trying to XSS you</b>"
//! );
//! assert_eq!(result, "<b><img src=\"\">I'm not trying to XSS you</b>");
//! ```
@@ -47,7 +47,7 @@ use std::collections::{HashMap, HashSet};
use std::fmt;
use std::io;
use std::iter::IntoIterator as IntoIter;
-use std::mem::replace;
+use std::mem;
use std::rc::Rc;
use std::str::FromStr;
use tendril::stream::TendrilSink;
@@ -59,18 +59,21 @@ use html5ever::buffer_queue::BufferQueue;
use html5ever::tokenizer::{Token, TokenSink, TokenSinkResult, Tokenizer};
pub use url;
-static AMMONIA: Lazy<Builder<'static>> = Lazy::new(|| Builder::default());
+static AMMONIA: Lazy<Builder<'static>> = Lazy::new(Builder::default);
/// Clean HTML with a conservative set of defaults.
///
/// * [tags](struct.Builder.html#defaults)
-/// * [attributes on specific tags](struct.Builder.html#defaults-1)
-/// * [attributes on all tags](struct.Builder.html#defaults-2)
-/// * [url schemes](struct.Builder.html#defaults-3)
-/// * [relative URLs are passed through, unchanged, by default](struct.Builder.html#defaults-4)
-/// * [links are marked `noopener noreferrer` by default](struct.Builder.html#defaults-5)
-/// * [all `class=""` settings are blocked by default](struct.Builder.html#defaults-6)
-/// * [comments are stripped by default](struct.Builder.html#defaults-7)
+/// * [`script` and `style` have their contents stripped](struct.Builder.html#defaults-1)
+/// * [attributes on specific tags](struct.Builder.html#defaults-2)
+/// * [attributes on all tags](struct.Builder.html#defaults-6)
+/// * [url schemes](struct.Builder.html#defaults-7)
+/// * [relative URLs are passed through, unchanged, by default](struct.Builder.html#defaults-8)
+/// * [links are marked `noopener noreferrer` by default](struct.Builder.html#defaults-9)
+/// * all `class=""` settings are blocked by default
+/// * comments are stripped by default
+/// * no generic attribute prefixes are turned on by default
+/// * no specific tag-attribute-value settings are configured by default
///
/// [opener]: https://mathiasbynens.github.io/rel-noopener/
/// [referrer]: https://en.wikipedia.org/wiki/HTTP_referer
@@ -368,7 +371,7 @@ pub struct Builder<'a> {
impl<'a> Default for Builder<'a> {
fn default() -> Self {
- #[cfg_attr(rustfmt, rustfmt_skip)]
+ #[rustfmt::skip]
let tags = hashset![
"a", "abbr", "acronym", "area", "article", "aside", "b", "bdi",
"bdo", "blockquote", "br", "caption", "center", "cite", "code",
@@ -597,7 +600,9 @@ impl<'a> Builder<'a> {
///
/// # Defaults
///
- /// No tags have content removed by default.
+ /// ```notest
+ /// script, style
+ /// ```
pub fn clean_content_tags(&mut self, value: HashSet<&'a str>) -> &mut Self {
self.clean_content_tags = value;
self
@@ -752,7 +757,7 @@ impl<'a> Builder<'a> {
) -> &mut Self {
self.tag_attributes
.entry(tag.borrow())
- .or_insert_with(|| HashSet::new())
+ .or_insert_with(HashSet::new)
.extend(it.into_iter().map(Borrow::borrow));
self
}
@@ -1078,9 +1083,7 @@ impl<'a> Builder<'a> {
///
/// # Defaults
///
- /// ```notest
- /// lang, title
- /// ```
+ /// No attribute prefixes are allowed by default.
pub fn generic_attribute_prefixes(&mut self, value: HashSet<&'a str>) -> &mut Self {
self.generic_attribute_prefixes = Some(value);
self
@@ -1478,7 +1481,7 @@ impl<'a> Builder<'a> {
/// a.link_rel(Some("a b"));
/// assert_eq!(a.get_link_rel(), Some("a b"));
pub fn get_link_rel(&self) -> Option<&str> {
- self.link_rel.clone()
+ self.link_rel
}
/// Sets the CSS classes that are allowed on specific tags.
@@ -1533,7 +1536,7 @@ impl<'a> Builder<'a> {
) -> &mut Self {
self.allowed_classes
.entry(tag.borrow())
- .or_insert_with(|| HashSet::new())
+ .or_insert_with(HashSet::new)
.extend(it.into_iter().map(Borrow::borrow));
self
}
@@ -1778,7 +1781,7 @@ impl<'a> Builder<'a> {
.is_none());
}
assert!(self.allowed_classes.is_empty() || !self.generic_attributes.contains("class"));
- for (tag_name, _classes) in &self.allowed_classes {
+ for tag_name in self.allowed_classes.keys() {
assert!(self
.tag_attributes
.get(tag_name)
@@ -1789,17 +1792,12 @@ impl<'a> Builder<'a> {
assert!(!self.tags.contains(tag_name));
assert!(!self.tag_attributes.contains_key(tag_name));
}
- let url_base = if let UrlRelative::RewriteWithBase(ref base) = self.url_relative {
- Some(base)
- } else {
- None
- };
let body = {
let children = dom.document.children.borrow();
children[0].clone()
};
stack.extend(
- replace(&mut *body.children.borrow_mut(), Vec::new())
+ mem::take(&mut *body.children.borrow_mut())
.into_iter()
.rev(),
);
@@ -1815,10 +1813,10 @@ impl<'a> Builder<'a> {
removed.push(node);
continue;
}
- let pass_clean = self.clean_child(&mut node, url_base);
+ let pass_clean = self.clean_child(&mut node);
let pass = pass_clean && self.check_expected_namespace(&parent, &node);
if pass {
- self.adjust_node_attributes(&mut node, &link_rel, url_base, self.id_prefix);
+ self.adjust_node_attributes(&mut node, &link_rel, self.id_prefix);
dom.append(&parent.clone(), NodeOrText::AppendNode(node.clone()));
} else {
for sub in node.children.borrow_mut().iter_mut() {
@@ -1826,7 +1824,7 @@ impl<'a> Builder<'a> {
}
}
stack.extend(
- replace(&mut *node.children.borrow_mut(), Vec::new())
+ mem::take(&mut *node.children.borrow_mut())
.into_iter()
.rev(),
);
@@ -1838,7 +1836,7 @@ impl<'a> Builder<'a> {
// Otherwise, we could wind up with a DoS, either caused by a memory leak,
// or caused by a stack overflow.
while let Some(node) = removed.pop() {
- removed.extend_from_slice(&replace(&mut *node.children.borrow_mut(), Vec::new())[..]);
+ removed.extend_from_slice(&mem::take(&mut *node.children.borrow_mut())[..]);
}
Document(dom)
}
@@ -1860,7 +1858,7 @@ impl<'a> Builder<'a> {
/// The root node doesn't need cleaning because we create the root node ourselves,
/// and it doesn't get serialized, and ... it just exists to give the parser
/// a context (in this case, a div-like block context).
- fn clean_child(&self, child: &mut Handle, url_base: Option<&Url>) -> bool {
+ fn clean_child(&self, child: &mut Handle) -> bool {
match child.data {
NodeData::Text { .. } => true,
NodeData::Comment { .. } => !self.strip_comments,
@@ -1904,13 +1902,7 @@ impl<'a> Builder<'a> {
if let Ok(url) = url {
self.url_schemes.contains(url.scheme())
} else if url == Err(url::ParseError::RelativeUrlWithoutBase) {
- if matches!(self.url_relative, UrlRelative::Deny) {
- false
- } else if let Some(url_base) = url_base {
- url_base.join(&*attr.value).is_ok()
- } else {
- true
- }
+ !matches!(self.url_relative, UrlRelative::Deny)
} else {
false
}
@@ -2061,7 +2053,6 @@ impl<'a> Builder<'a> {
&self,
child: &mut Handle,
link_rel: &Option<StrTendril>,
- url_base: Option<&Url>,
id_prefix: Option<&'a str>,
) {
if let NodeData::Element {
@@ -2099,10 +2090,8 @@ impl<'a> Builder<'a> {
}
if let Some(ref id_prefix) = id_prefix {
for attr in &mut *attrs.borrow_mut() {
- if &attr.name.local == "id" {
- if !attr.value.starts_with(id_prefix) {
- attr.value = format_tendril!("{}{}", id_prefix, attr.value);
- }
+ if &attr.name.local == "id" && !attr.value.starts_with(id_prefix) {
+ attr.value = format_tendril!("{}{}", id_prefix, attr.value);
}
}
}
@@ -2130,27 +2119,13 @@ impl<'a> Builder<'a> {
attrs.swap_remove(i);
}
}
- if let Some(ref base) = url_base {
- for attr in &mut *attrs.borrow_mut() {
- if is_url_attr(&*name.local, &*attr.name.local) {
- let url = base
- .join(&*attr.value)
- .expect("invalid URLs should be stripped earlier");
- attr.value = format_tendril!("{}", url);
- }
- }
- } else if let UrlRelative::Custom(ref evaluate) = self.url_relative {
+ {
let mut drop_attrs = Vec::new();
let mut attrs = attrs.borrow_mut();
for (i, attr) in attrs.iter_mut().enumerate() {
if is_url_attr(&*name.local, &*attr.name.local) && is_url_relative(&*attr.value)
{
- let new_value = evaluate
- .evaluate(&*attr.value)
- .as_ref()
- .map(Cow::as_ref)
- .map(StrTendril::from_str)
- .and_then(Result::ok);
+ let new_value = self.url_relative.evaluate(&*attr.value);
if let Some(new_value) = new_value {
attr.value = new_value;
} else {
@@ -2212,7 +2187,8 @@ fn is_url_attr(element: &str, attr: &str) -> bool {
/// Given an element name, check if it's SVG
fn is_svg_tag(element: &str) -> bool {
// https://svgwg.org/svg2-draft/eltindex.html
- match element {
+ matches!(
+ element,
"a"
| "animate"
| "animateMotion"
@@ -2276,15 +2252,14 @@ fn is_svg_tag(element: &str) -> bool {
| "title"
| "tspan"
| "use"
- | "view" => true,
- _ => false,
- }
+ | "view"
+ )
}
/// Given an element name, check if it's Math
fn is_mathml_tag(element: &str) -> bool {
// https://svgwg.org/svg2-draft/eltindex.html
- match element {
+ matches!(element,
"abs"
| "and"
| "annotation"
@@ -2478,9 +2453,8 @@ fn is_mathml_tag(element: &str) -> bool {
| "variance"
| "vector"
| "vectorproduct"
- | "xor" => true,
- _ => false,
- }
+ | "xor"
+ )
}
fn is_url_relative(url: &str) -> bool {
@@ -2558,10 +2532,133 @@ pub enum UrlRelative {
PassThrough,
/// Relative URLs will be changed into absolute URLs, based on this base URL.
RewriteWithBase(Url),
+ /// Force absolute and relative paths into a particular directory.
+ ///
+ /// Since the resolver does not affect fully-qualified URLs, it doesn't
+ /// prevent users from linking wherever they want. This feature only
+ /// serves to make content more portable.
+ ///
+ /// # Examples
+ ///
+ /// <table>
+ /// <thead>
+ /// <tr>
+ /// <th>root</th>
+ /// <th>path</th>
+ /// <th>url</th>
+ /// <th>result</th>
+ /// </tr>
+ /// </thead>
+ /// <tbody>
+ /// <tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// <td>README.md</td>
+ /// <td></td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/README.md</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// <td>README.md</td>
+ /// <td>/</td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// <td>README.md</td>
+ /// <td>/CONTRIBUTING.md</td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/CONTRIBUTING.md</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master</td>
+ /// <td>README.md</td>
+ /// <td></td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/README.md</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master</td>
+ /// <td>README.md</td>
+ /// <td>/</td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master</td>
+ /// <td>README.md</td>
+ /// <td>/CONTRIBUTING.md</td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/CONTRIBUTING.md</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// <td></td>
+ /// <td></td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// <td></td>
+ /// <td>/</td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// </tr><tr>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/</td>
+ /// <td></td>
+ /// <td>/CONTRIBUTING.md</td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/CONTRIBUTING.md</td>
+ /// </tr><tr>
+ /// <td>https://github.com/</td>
+ /// <td>rust-ammonia/ammonia/blob/master/README.md</td>
+ /// <td></td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/README.md</td>
+ /// </tr><tr>
+ /// <td>https://github.com/</td>
+ /// <td>rust-ammonia/ammonia/blob/master/README.md</td>
+ /// <td>/</td>
+ /// <td>https://github.com/</td>
+ /// </tr><tr>
+ /// <td>https://github.com/</td>
+ /// <td>rust-ammonia/ammonia/blob/master/README.md</td>
+ /// <td>CONTRIBUTING.md</td>
+ /// <td>https://github.com/rust-ammonia/ammonia/blob/master/CONTRIBUTING.md</td>
+ /// </tr><tr>
+ /// <td>https://github.com/</td>
+ /// <td>rust-ammonia/ammonia/blob/master/README.md</td>
+ /// <td>/CONTRIBUTING.md</td>
+ /// <td>https://github.com/CONTRIBUTING.md</td>
+ /// </tr>
+ /// </tbody>
+ /// </table>
+ RewriteWithRoot {
+ /// The URL that is treated as the root by the resolver.
+ root: Url,
+ /// The "current path" used to resolve relative paths.
+ path: String,
+ },
/// Rewrite URLs with a custom function.
Custom(Box<dyn UrlRelativeEvaluate>),
}
+impl UrlRelative {
+ fn evaluate(&self, url: &str) -> Option<tendril::StrTendril> {
+ match self {
+ UrlRelative::RewriteWithBase(ref url_base) => {
+ url_base.join(url).ok().and_then(|x| StrTendril::from_str(x.as_str()).ok())
+ }
+ UrlRelative::RewriteWithRoot { ref root, ref path } => {
+ (match url.as_bytes() {
+ // Scheme-relative URL
+ [b'/', b'/', ..] => root.join(url),
+ // Path-absolute URL
+ b"/" => root.join("."),
+ [b'/', ..] => root.join(&url[1..]),
+ // Path-relative URL
+ _ => root.join(path).and_then(|r| r.join(url)),
+ }).ok().and_then(|x| StrTendril::from_str(x.as_str()).ok())
+ }
+ UrlRelative::Custom(ref evaluate) => {
+ evaluate
+ .evaluate(&*url)
+ .as_ref()
+ .map(Cow::as_ref)
+ .map(StrTendril::from_str)
+ .and_then(Result::ok)
+ }
+ UrlRelative::PassThrough => StrTendril::from_str(url).ok(),
+ UrlRelative::Deny => None,
+ }
+ }
+}
+
impl fmt::Debug for UrlRelative {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
@@ -2570,6 +2667,9 @@ impl fmt::Debug for UrlRelative {
UrlRelative::RewriteWithBase(ref base) => {
write!(f, "UrlRelative::RewriteWithBase({})", base)
}
+ UrlRelative::RewriteWithRoot { ref root, ref path } => {
+ write!(f, "UrlRelative::RewriteWithRoot {{ root: {root}, path: {path} }}")
+ }
UrlRelative::Custom(_) => write!(f, "UrlRelative::Custom"),
}
}
@@ -3623,4 +3723,100 @@ mod test {
let fragment = "<b>";
assert!(is_html(fragment));
}
+
+ #[test]
+ fn rewrite_with_root() {
+ let tests = [
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ "README.md",
+ "",
+ "https://github.com/rust-ammonia/ammonia/blob/master/README.md",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ "README.md",
+ "/",
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ "README.md",
+ "/CONTRIBUTING.md",
+ "https://github.com/rust-ammonia/ammonia/blob/master/CONTRIBUTING.md",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master",
+ "README.md",
+ "",
+ "https://github.com/rust-ammonia/ammonia/blob/README.md",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master",
+ "README.md",
+ "/",
+ "https://github.com/rust-ammonia/ammonia/blob/",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master",
+ "README.md",
+ "/CONTRIBUTING.md",
+ "https://github.com/rust-ammonia/ammonia/blob/CONTRIBUTING.md",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ "",
+ "",
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ "",
+ "/",
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ ),
+ (
+ "https://github.com/rust-ammonia/ammonia/blob/master/",
+ "",
+ "/CONTRIBUTING.md",
+ "https://github.com/rust-ammonia/ammonia/blob/master/CONTRIBUTING.md",
+ ),
+ (
+ "https://github.com/",
+ "rust-ammonia/ammonia/blob/master/README.md",
+ "",
+ "https://github.com/rust-ammonia/ammonia/blob/master/README.md",
+ ),
+ (
+ "https://github.com/",
+ "rust-ammonia/ammonia/blob/master/README.md",
+ "/",
+ "https://github.com/",
+ ),
+ (
+ "https://github.com/",
+ "rust-ammonia/ammonia/blob/master/README.md",
+ "CONTRIBUTING.md",
+ "https://github.com/rust-ammonia/ammonia/blob/master/CONTRIBUTING.md",
+ ),
+ (
+ "https://github.com/",
+ "rust-ammonia/ammonia/blob/master/README.md",
+ "/CONTRIBUTING.md",
+ "https://github.com/CONTRIBUTING.md",
+ ),
+ ];
+ for (root, path, url, result) in tests {
+ let h = format!(r#"<a href="{url}">test</a>"#);
+ let r = format!(r#"<a href="{result}" rel="noopener noreferrer">test</a>"#);
+ let a = Builder::new()
+ .url_relative(UrlRelative::RewriteWithRoot { root: Url::parse(root).unwrap(), path: path.to_string() })
+ .clean(&h)
+ .to_string();
+ if r != a {
+ println!("failed to check ({root}, {path}, {url}, {result})\n{r} != {a}", r = r);
+ assert_eq!(r, a);
+ }
+ }
+ }
}
diff --git a/vendor/ammonia/src/rcdom.rs b/vendor/ammonia/src/rcdom.rs
index 2d3917e55..bd742536f 100644
--- a/vendor/ammonia/src/rcdom.rs
+++ b/vendor/ammonia/src/rcdom.rs
@@ -126,9 +126,9 @@ impl Node {
impl Drop for Node {
fn drop(&mut self) {
- let mut nodes = mem::replace(&mut *self.children.borrow_mut(), vec![]);
+ let mut nodes = mem::take(&mut *self.children.borrow_mut());
while let Some(node) = nodes.pop() {
- let children = mem::replace(&mut *node.children.borrow_mut(), vec![]);
+ let children = mem::take(&mut *node.children.borrow_mut());
nodes.extend(children.into_iter());
if let NodeData::Element { ref template_contents, .. } = node.data {
if let Some(template_contents) = template_contents.borrow_mut().take() {
@@ -172,7 +172,7 @@ fn get_parent_and_index(target: &Handle) -> Option<(Handle, usize)> {
.borrow()
.iter()
.enumerate()
- .find(|&(_, child)| Rc::ptr_eq(&child, &target))
+ .find(|&(_, child)| Rc::ptr_eq(child, target))
{
Some((i, _)) => i,
None => panic!("have parent but couldn't find in parent's children!"),
@@ -286,20 +286,16 @@ impl TreeSink for RcDom {
fn append(&mut self, parent: &Handle, child: NodeOrText<Handle>) {
// Append to an existing Text node if we have one.
- match child {
- NodeOrText::AppendText(ref text) => match parent.children.borrow().last() {
- Some(h) => {
- if append_to_existing_text(h, &text) {
- return;
- }
- },
- _ => (),
- },
- _ => (),
+ if let NodeOrText::AppendText(ref text) = child {
+ if let Some(h) = parent.children.borrow().last() {
+ if append_to_existing_text(h, text) {
+ return;
+ }
+ }
}
append(
- &parent,
+ parent,
match child {
NodeOrText::AppendText(text) => Node::new(NodeData::Text {
contents: RefCell::new(text),
@@ -310,7 +306,7 @@ impl TreeSink for RcDom {
}
fn append_before_sibling(&mut self, sibling: &Handle, child: NodeOrText<Handle>) {
- let (parent, i) = get_parent_and_index(&sibling)
+ let (parent, i) = get_parent_and_index(sibling)
.expect("append_before_sibling called on node without parent");
let child = match (child, i) {
@@ -396,20 +392,20 @@ impl TreeSink for RcDom {
}
fn remove_from_parent(&mut self, target: &Handle) {
- remove_from_parent(&target);
+ remove_from_parent(target);
}
fn reparent_children(&mut self, node: &Handle, new_parent: &Handle) {
let mut children = node.children.borrow_mut();
let mut new_children = new_parent.children.borrow_mut();
for child in children.iter() {
- let previous_parent = child.parent.replace(Some(Rc::downgrade(&new_parent)));
+ let previous_parent = child.parent.replace(Some(Rc::downgrade(new_parent)));
assert!(Rc::ptr_eq(
- &node,
+ node,
&previous_parent.unwrap().upgrade().expect("dangling weak")
))
}
- new_children.extend(mem::replace(&mut *children, Vec::new()));
+ new_children.extend(mem::take(&mut *children));
}
fn is_mathml_annotation_xml_integration_point(&self, target: &Handle) -> bool {
@@ -485,13 +481,13 @@ impl Serialize for SerializableHandle {
}
},
- NodeData::Doctype { ref name, .. } => serializer.write_doctype(&name)?,
+ NodeData::Doctype { ref name, .. } => serializer.write_doctype(name)?,
NodeData::Text { ref contents } => {
serializer.write_text(&contents.borrow())?
},
- NodeData::Comment { ref contents } => serializer.write_comment(&contents)?,
+ NodeData::Comment { ref contents } => serializer.write_comment(contents)?,
NodeData::ProcessingInstruction {
ref target,