Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Binary Files are Incorrectly Handled #4

@redfire75369

Description

@redfire75369

In this section of code, it is assumed that all files are UTF-8. There are many cases where such a file is not UTF-8 however, such as images. Such files should be excluded from the replacements.

next-pages/src/index.js

Lines 67 to 75 in 0bc287a

if (stat.isFile()) {
let fileContent = await fs.promises.readFile(fullpath, "utf-8")
replacements.forEach(re => {
fileContent = fileContent.replace(re.find, re.replace)
})
await fs.promises.writeFile(fullpath, fileContent)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions