mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-03-26 21:43:00 +00:00
Dateien nach „services/repository/files“ hochladen
This commit is contained in:
parent
b4751de632
commit
e910714237
1 changed files with 5 additions and 5 deletions
|
@ -6,11 +6,11 @@ package files
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"regexp"
|
|
||||||
"html"
|
|
||||||
|
|
||||||
git_model "code.gitea.io/gitea/models/git"
|
git_model "code.gitea.io/gitea/models/git"
|
||||||
repo_model "code.gitea.io/gitea/models/repo"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
|
@ -168,12 +168,12 @@ var fileNameSanitizeRegexp = regexp.MustCompile(`(?i)\.\.|[<>:\"\\|?*\x{0000}-\x
|
||||||
|
|
||||||
// Sanitize user input to valid OS filenames
|
// Sanitize user input to valid OS filenames
|
||||||
//
|
//
|
||||||
// Based on https://github.com/sindresorhus/filename-reserved-regex
|
// Based on https://github.com/sindresorhus/filename-reserved-regex
|
||||||
// Adds ".." to prevent directory traversal
|
// Adds ".." to prevent directory traversal
|
||||||
func fileNameSanitize(s string) string {
|
func fileNameSanitize(s string) string {
|
||||||
// Added this because I am not sure what Windows will deliver us \ or / but we need /.
|
// Added this because I am not sure what Windows will deliver us \ or / but we need /.
|
||||||
s = strings.ReplaceAll(s, "\\", "/")
|
s = strings.ReplaceAll(s, "\\", "/")
|
||||||
return strings.TrimSpace(fileNameSanitizeRegexp.ReplaceAllString(s, "_"))
|
return strings.TrimSpace(fileNameSanitizeRegexp.ReplaceAllString(s, "_"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyUploadedLFSFilesIntoRepository(infos []uploadInfo, t *TemporaryUploadRepository, treePath string) error {
|
func copyUploadedLFSFilesIntoRepository(infos []uploadInfo, t *TemporaryUploadRepository, treePath string) error {
|
||||||
|
|
Loading…
Reference in a new issue