squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
21.05k stars 3.56k forks source link

Privacy plugin causes a 404 on css #7672

Closed dr-br closed 1 week ago

dr-br commented 2 weeks ago

Context

No response

Bug description

Starting with 9.5.43 the privacy plugin causes an invalid include of a css file.
The file assets/external/fonts.googleapis.com/css.49ea35f2.css is not found, resulting in a 404.
The default Roboto font is not available, resulting in some less fancy backup font.

Version 9.5.42 and before is fine.

Related links

Reproduction

9.5.43-privacy-plugin-bug.zip

Steps to reproduce

Browser

No response

Before submitting

squidfunk commented 1 week ago

Thanks for reporting. Confirmed, it's a regression in 9.5.43.

squidfunk commented 1 week ago

Tagging @nejch for visibility – there seems to be some side effect in the merged changed. The CSS file is downloaded but not copied to the site directory.

nejch commented 1 week ago

Strange, in my testing it was at least downloading the external files I was referencing. From the logs comparing the repro demo with .42 and .43 there's no immediate clue, but I'm guessing the new named group regex handling might affect things - taking a look as well.

nejch commented 1 week ago

That does seem to be the case, e.g.

https://github.com/squidfunk/mkdocs-material/blob/ac3315fd3e25b9449306d0dac6cd535d4d32d9ea/src/plugins/privacy/plugin.py#L470

When using named groups here this should work consistently:

(.venv) z003wwtz@framework:~/tmp/9.5.43-privacy-plugin-bug$ mkdocs build
INFO    -  Cleaning site directory
INFO    -  Building documentation to directory: /home/z003wwtz/tmp/9.5.43-privacy-plugin-bug/public
INFO    -  Downloading external file: https://unpkg.com/mermaid@11/dist/mermaid.min.js
INFO    -  Downloading external file:
           https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOkCnqEu92Fr1Mu51xIIzI.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmSU5fBBc4.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu72xKOzY.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu5mxKOzY.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu7mxKOzY.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu4WxKOzY.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu7WxKOzY.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu7GxKOzY.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOmCnqEu92Fr1Mu4mxK.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2
INFO    -  Downloading external file: https://fonts.gstatic.com/s/roboto/v32/KFOlCnqEu92Fr1MmWUlfBBc4.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2
INFO    -  Downloading external file:
           https://fonts.gstatic.com/s/robotomono/v23/L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2
INFO    -  Documentation built in 1.87 seconds
(.venv) z003wwtz@framework:~/tmp/9.5.43-privacy-plugin-bug$ tree public/assets/external/
public/assets/external/
├── fonts.googleapis.com
│   └── css.49ea35f2.css
├── fonts.gstatic.com
│   └── s
│       ├── roboto
│       │   └── v32
│       │       ├── KFOjCnqEu92Fr1Mu51TjASc0CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TjASc1CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TjASc2CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TjASc3CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TjASc5CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TjASc6CsQ.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TjASc-CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TzBic0CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TzBic1CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TzBic2CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TzBic3CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TzBic5CsTKlA.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TzBic6CsQ.woff2
│       │       ├── KFOjCnqEu92Fr1Mu51TzBic-CsTKlA.woff2
│       │       ├── KFOkCnqEu92Fr1Mu51xEIzIFKw.woff2
│       │       ├── KFOkCnqEu92Fr1Mu51xFIzIFKw.woff2
│       │       ├── KFOkCnqEu92Fr1Mu51xGIzIFKw.woff2
│       │       ├── KFOkCnqEu92Fr1Mu51xHIzIFKw.woff2
│       │       ├── KFOkCnqEu92Fr1Mu51xIIzI.woff2
│       │       ├── KFOkCnqEu92Fr1Mu51xLIzIFKw.woff2
│       │       ├── KFOkCnqEu92Fr1Mu51xMIzIFKw.woff2
│       │       ├── KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmSU5fBBc4.woff2
│       │       ├── KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmWUlfBBc4.woff2
│       │       ├── KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2
│       │       ├── KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2
│       │       ├── KFOmCnqEu92Fr1Mu4mxK.woff2
│       │       ├── KFOmCnqEu92Fr1Mu4WxKOzY.woff2
│       │       ├── KFOmCnqEu92Fr1Mu5mxKOzY.woff2
│       │       ├── KFOmCnqEu92Fr1Mu72xKOzY.woff2
│       │       ├── KFOmCnqEu92Fr1Mu7GxKOzY.woff2
│       │       ├── KFOmCnqEu92Fr1Mu7mxKOzY.woff2
│       │       └── KFOmCnqEu92Fr1Mu7WxKOzY.woff2
│       └── robotomono
│           └── v23
│               ├── L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEleUlYIw.woff2
│               ├── L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtElOUlYIw.woff2
│               ├── L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEluUlYIw.woff2
│               ├── L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEmOUlYIw.woff2
│               ├── L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEm-Ul.woff2
│               ├── L0xdDF4xlVMF-BfR8bXMIjhOsXG-q2oeuFoqFrlnAIe2Imhk1T8rbociImtEn-UlYIw.woff2
│               ├── L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSd0mf0h.woff2
│               ├── L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSh0mQ.woff2
│               ├── L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSt0mf0h.woff2
│               ├── L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSV0mf0h.woff2
│               ├── L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSx0mf0h.woff2
│               └── L0xTDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_3vrtSM1J-gEPT5Ese6hmHSZ0mf0h.woff2
└── unpkg.com
    └── mermaid@11
        └── dist
            └── mermaid.min.js

10 directories, 56 files

Just need to check that it is applied consistently when using value = match.group("url") Should have added some tests in the PR :sweat_smile:

@squidfunk is this something you're already looking into or should I start a PR?

Edit: checked that the assets_expr_map regexes were only used in this replace callbacks so this should be enough. I went ahead and started https://github.com/squidfunk/mkdocs-material/pull/7673 since I felt responsible for the regression :sweat_smile: but feel to close it if you think there's also a more comprehensive fix :bow:

squidfunk commented 1 week ago

Thanks for the very fast fix @nejch! Keeping open until released.

squidfunk commented 1 week ago

Released as part of 9.5.44. Thanks again, @nejch!

dr-br commented 1 week ago

Excellent response time! Thanks and Dankeschön :)