up209d / ResourcesSaverExt

Chrome Extension for one click downloading all resources files and keeping folder structures.
GNU General Public License v3.0
1.65k stars 337 forks source link

HTML src attributes & File names are mismatched #40

Open Gregory-Ledray opened 3 years ago

Gregory-Ledray commented 3 years ago

Problem

When using this extension to retrieve my website https://polyapp.tech I encountered a problem with the downloaded images. The image URLs and other blobs on my website are very unusually formatted: https://polyapp.tech/blob/assets/AdvEblIPeH4YqkvzwwzM/Custom%20Computer%20Programming%20Services_Website%20Builder_vzIHXFJTaafUaotePCHFNZeDh_BodyBlobtgVDgEXakrysXdBB6uNuOzt47

When downloaded, this image is saved with an extension, ".jpg", and also the %20 characters are converted to spaces when saving the file.

Is this intended? I think this is a good thing since it makes the file easier to open on the destination computer and the file name easier to read.

Despite the benefits, there is now a problem when I transfer the file and try to serve it with a simple web server in Go:

package main

import (
    "net/http"
)

func main() {
    http.Handle("/", http.FileServer(http.Dir("./polyapp.tech")))
    http.ListenAndServe(":3500", nil)
}

Although most of the page loads, the images do not: image

The problem is a mismatch in the easy to read file name which is downloaded by this extension and the HTML "src" attribute in the downloaded file which is still using the harder-to-read file name which does not contain the ".jpg" extension.

Suggested Solution

I would investigate and fix this issue in the code myself with a PR if #39 is resolved.

duc-duong-energetiq commented 3 years ago

Yeah, thanks for letting me know about this. I did got few feedback around that, since I am working on the next version to refactor my messy code, make a better source, I gonna let it keeping the original source files as is, along with the resolved filename ones.