Skip to content

Commit f3cbdee

Browse files
authored
Don't clean up hardcoded tmp (#18983)
* Don't clean up hardcoded `tmp`. * Fixed import.
1 parent efd10f1 commit f3cbdee

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

custom/conf/app.example.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ PATH =
890890
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
891891
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
892892
;;
893-
;; Path for local repository copy. Defaults to `tmp/local-repo`
893+
;; Path for local repository copy. Defaults to `tmp/local-repo` (content gets deleted on gitea restart)
894894
;LOCAL_COPY_PATH = tmp/local-repo
895895

896896
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -902,7 +902,7 @@ PATH =
902902
;; Whether repository file uploads are enabled. Defaults to `true`
903903
;ENABLED = true
904904
;;
905-
;; Path for uploads. Defaults to `data/tmp/uploads` (tmp gets deleted on gitea restart)
905+
;; Path for uploads. Defaults to `data/tmp/uploads` (content gets deleted on gitea restart)
906906
;TEMP_PATH = data/tmp/uploads
907907
;;
908908
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
107107
### Repository - Upload (`repository.upload`)
108108

109109
- `ENABLED`: **true**: Whether repository file uploads are enabled
110-
- `TEMP_PATH`: **data/tmp/uploads**: Path for uploads (tmp gets deleted on Gitea restart)
110+
- `TEMP_PATH`: **data/tmp/uploads**: Path for uploads (content gets deleted on Gitea restart)
111111
- `ALLOWED_TYPES`: **\<empty\>**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
112112
- `FILE_MAX_SIZE`: **3**: Max size of each file in megabytes.
113113
- `MAX_FILES`: **5**: Max number of files per upload
@@ -144,7 +144,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
144144

145145
## Repository - Local (`repository.local`)
146146

147-
- `LOCAL_COPY_PATH`: **tmp/local-repo**: Path for temporary local repository copies. Defaults to `tmp/local-repo`
147+
- `LOCAL_COPY_PATH`: **tmp/local-repo**: Path for temporary local repository copies. Defaults to `tmp/local-repo` (content gets deleted on Gitea restart)
148148

149149
## Repository - MIME type mapping (`repository.mimetype_mapping`)
150150

models/repo.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"fmt"
1111
"os"
1212
"path"
13-
"path/filepath"
1413
"sort"
1514
"strconv"
1615
"strings"
@@ -123,7 +122,8 @@ func NewRepoContext() {
123122
loadRepoConfig()
124123
unit.LoadUnitConfig()
125124

126-
admin_model.RemoveAllWithNotice(db.DefaultContext, "Clean up repository temporary data", filepath.Join(setting.AppDataPath, "tmp"))
125+
admin_model.RemoveAllWithNotice(db.DefaultContext, "Clean up temporary repository uploads", setting.Repository.Upload.TempPath)
126+
admin_model.RemoveAllWithNotice(db.DefaultContext, "Clean up temporary repositories", LocalCopyPath())
127127
}
128128

129129
// CheckRepoUnitUser check whether user could visit the unit of this repository

0 commit comments

Comments
 (0)