mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-12 18:32:44 +00:00
fix: fix anonymization of raw links
This commit is contained in:
@@ -218,7 +218,7 @@ export default class AnonymizedFile {
|
||||
res.header("Accept-Ranges", "none");
|
||||
try {
|
||||
const fileInfo = await storage.fileInfo(this.originalCachePath);
|
||||
if (fileInfo.size) {
|
||||
if (!isTextFile(this.anonymizedPath) && fileInfo.size) {
|
||||
res.header("Content-Length", fileInfo.size.toString());
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -79,6 +79,15 @@ export function anonymizeContent(
|
||||
}
|
||||
|
||||
if (repository.source instanceof GitHubBase) {
|
||||
content = content.replace(
|
||||
new RegExp(
|
||||
`https://raw.githubusercontent.com/${
|
||||
repository.source.githubRepository.fullName
|
||||
}/${repository.source.branch?.name || "main"}\\b`,
|
||||
"gi"
|
||||
),
|
||||
`https://${config.APP_HOSTNAME}/r/${repository.repoId}`
|
||||
);
|
||||
content = content.replace(
|
||||
new RegExp(
|
||||
`https://github.com/${
|
||||
|
||||
Reference in New Issue
Block a user