mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Clean paths when looking in Storage (#19124)
* Clean paths when looking in Storage Ensure paths are clean for minio aswell as local storage. Use url.Path not RequestURI/EscapedPath in storageHandler. Signed-off-by: Andrew Thornton <art27@cantab.net> * Apply suggestions from code review Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		@@ -117,7 +117,7 @@ func NewMinioStorage(ctx context.Context, cfg interface{}) (ObjectStorage, error
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *MinioStorage) buildMinioPath(p string) string {
 | 
			
		||||
	return strings.TrimPrefix(path.Join(m.basePath, p), "/")
 | 
			
		||||
	return strings.TrimPrefix(path.Join(m.basePath, path.Clean("/" + strings.ReplaceAll(p, "\\", "/"))[1:]), "/")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Open open a file
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user