darkreader: extension creates 404 requests for images in css files with relative path
This extension creates a lot of 404 requests on web servers which uses background-images in CSS files with an relative path.
e.g. i have following files:
/test.html
/sub/test.html
/css/style.css
/css/images/background.png
Content of /test.html (for the test.html in sub directory href=“…/css/style.css”
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
<title>test in root</title>
</head>
<body>
<div class="my-class">
this should have a background
</div>
</body>
</html>
content of /css/style.css
.my-class {
height:500px;
width: 500px;
display: block;
background: url("images/background.png") repeat scroll 0 0 green;
}
e.g. if i open/test.html
without dark reader enabled:
with dark reader enabled:
the background image is requested 3 times! http://localhost/test/image-test/css/images/background.png (correct path from the html code) http://localhost/test/image-test/css/images/background.png (by the index.js code from the extension) http://localhost/test/image-test/images/background.png => 404 html error
Relative URLs are allowed, and are relative to the URL of the stylesheet (not to the URL of the web page).
Same issue of course also for html requests which are located in sub directories e.g. /sub/test.html
.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 13
- Comments: 27 (11 by maintainers)
Commits related to this issue
- fix wrong requests #1933 — committed to 3axapp/darkreader by 3axapp 4 years ago
I also experience this problem with relative paths. The CSS is like
background-image:url(../../imgs/arrow.svg);
, but Dark Reader tries to make a request tourl(../../../imgs/arrow.svg);
orurl(/imgs/arrow.svg);
(idk, I see the full path in the console, and it starts with/imgs
, but should start with/foo/imgs
).Thank you, I will try to reproduce the path problem.
I just stumbled upon the same issue after seeing seemingly random 404 entries in my log file when using
background-image: url('../../images/image.png')
in my CSS files.In Dark Reader settings you can choose theme generation mode other than Dynamic but every other isn’t cool. You can also write your custom theme mode with click on Static theme generation mode.