Skip to content

Commit 4c78dfc

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: fixed duplicate attachments on dump on windows (go-gitea#28019) [skip ci] Updated translations via Crowdin packages: Calculate package size quota using package creator ID instead of owner ID (go-gitea#28007) Dont leak private users via extensions (go-gitea#28023) Improve profile for Organizations (go-gitea#27982) Enable system users search via the API (go-gitea#28013) Enable system users for comment.LoadPoster (go-gitea#28014) Change default size of issue/pr attachments and repo file (go-gitea#27946) Fix missing mail reply address (go-gitea#27997)
2 parents 8c55452 + 5380fd5 commit 4c78dfc

File tree

18 files changed

+208
-70
lines changed

18 files changed

+208
-70
lines changed

cmd/dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func addRecursiveExclude(w archiver.Writer, insidePath, absPath string, excludeA
452452
return err
453453
}
454454
for _, file := range files {
455-
currentAbsPath := path.Join(absPath, file.Name())
455+
currentAbsPath := filepath.Join(absPath, file.Name())
456456
currentInsidePath := path.Join(insidePath, file.Name())
457457
if file.IsDir() {
458458
if !util.SliceContainsString(excludeAbsPath, currentAbsPath) {

custom/conf/app.example.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,8 @@ LEVEL = Info
10161016
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
10171017
;ALLOWED_TYPES =
10181018
;;
1019-
;; Max size of each file in megabytes. Defaults to 3MB
1020-
;FILE_MAX_SIZE = 3
1019+
;; Max size of each file in megabytes. Defaults to 50MB
1020+
;FILE_MAX_SIZE = 50
10211021
;;
10221022
;; Max number of files per upload. Defaults to 5
10231023
;MAX_FILES = 5
@@ -1821,8 +1821,8 @@ LEVEL = Info
18211821
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
18221822
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
18231823
;;
1824-
;; Max size of each file. Defaults to 4MB
1825-
;MAX_SIZE = 4
1824+
;; Max size of each file. Defaults to 2048MB
1825+
;MAX_SIZE = 2048
18261826
;;
18271827
;; Max number of files per upload. Defaults to 5
18281828
;MAX_FILES = 5

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ In addition, there is _`StaticRootPath`_ which can be set as a built-in at build
146146
- `ENABLED`: **true**: Whether repository file uploads are enabled
147147
- `TEMP_PATH`: **data/tmp/uploads**: Path for uploads (content gets deleted on Gitea restart)
148148
- `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.
149-
- `FILE_MAX_SIZE`: **3**: Max size of each file in megabytes.
149+
- `FILE_MAX_SIZE`: **50**: Max size of each file in megabytes.
150150
- `MAX_FILES`: **5**: Max number of files per upload
151151

152152
### Repository - Release (`repository.release`)
@@ -823,7 +823,7 @@ Default templates for project boards:
823823

824824
- `ENABLED`: **true**: Whether issue and pull request attachments are enabled.
825825
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
826-
- `MAX_SIZE`: **4**: Maximum size (MB).
826+
- `MAX_SIZE`: **2048**: Maximum size (MB).
827827
- `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once.
828828
- `STORAGE_TYPE`: **local**: Storage type for attachments, `local` for local disk or `minio` for s3 compatible object storage service, default is `local` or other name defined with `[storage.xxx]`
829829
- `SERVE_DIRECT`: **false**: Allows the storage driver to redirect to authenticated URLs to serve files directly. Currently, only Minio/S3 is supported via signed URLs, local does nothing.

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ menu:
145145
- `ENABLED`: **true**: 是否启用仓库文件上传。
146146
- `TEMP_PATH`: **data/tmp/uploads**: 文件上传的临时保存路径(在Gitea重启的时候该目录会被清空)。
147147
- `ALLOWED_TYPES`: **_empty_**: 以逗号分割的列表,代表支持上传的文件类型。(`.zip`), mime类型 (`text/plain`) or 通配符类型 (`image/*`, `audio/*`, `video/*`). 为空或者 `*/*`代表允许所有类型文件。
148-
- `FILE_MAX_SIZE`: **3**: 每个文件的最大大小(MB)。
148+
- `FILE_MAX_SIZE`: **50**: 每个文件的最大大小(MB)。
149149
- `MAX_FILES`: **5**: 每次上传的最大文件数。
150150

151151
### 仓库 - 版本发布 (`repository.release`)
@@ -783,7 +783,7 @@ Gitea 创建以下非唯一队列:
783783

784784
- `ENABLED`: **true**: 是否允许用户上传附件。
785785
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: 允许的文件扩展名(`.zip`)、mime 类型(`text/plain`)或通配符类型(`image/*``audio/*``video/*`)的逗号分隔列表。空值或 `*/*` 允许所有类型。
786-
- `MAX_SIZE`: **4**: 附件的最大限制(MB)。
786+
- `MAX_SIZE`: **2048**: 附件的最大限制(MB)。
787787
- `MAX_FILES`: **5**: 一次最多上传的附件数量。
788788
- `STORAGE_TYPE`: **local**: 附件的存储类型,`local` 表示本地磁盘,`minio` 表示兼容 S3 的对象存储服务,如果未设置将使用默认值 `local` 或其他在 `[storage.xxx]` 中定义的名称。
789789
- `SERVE_DIRECT`: **false**: 允许存储驱动器重定向到经过身份验证的 URL 以直接提供文件。目前,只支持 Minio/S3 通过签名 URL 提供支持,local 不会执行任何操作。

models/issues/comment.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ func (t CommentType) HasAttachmentSupport() bool {
183183
return false
184184
}
185185

186+
func (t CommentType) HasMailReplySupport() bool {
187+
switch t {
188+
case CommentTypeComment, CommentTypeCode, CommentTypeReview, CommentTypeDismissReview, CommentTypeReopen, CommentTypeClose, CommentTypeMergePull, CommentTypeAssignees:
189+
return true
190+
}
191+
return false
192+
}
193+
186194
// RoleInRepo presents the user's participation in the repo
187195
type RoleInRepo string
188196

@@ -342,7 +350,7 @@ func (c *Comment) AfterLoad(session *xorm.Session) {
342350

343351
// LoadPoster loads comment poster
344352
func (c *Comment) LoadPoster(ctx context.Context) (err error) {
345-
if c.PosterID <= 0 || c.Poster != nil {
353+
if c.Poster != nil {
346354
return nil
347355
}
348356

models/packages/package_file.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,15 @@ func CalculateFileSize(ctx context.Context, opts *PackageFileSearchOptions) (int
230230
Join("INNER", "package_blob", "package_blob.id = package_file.blob_id").
231231
SumInt(new(PackageBlob), "size")
232232
}
233+
234+
// CalculateCreatorPackageQuota sums up all blob sizes related to package
235+
// version creator id.
236+
// It does NOT respect the deduplication of blobs.
237+
func CalculateCreatorPackageQuota(ctx context.Context, creatorID int64) (int64, error) {
238+
return db.GetEngine(ctx).
239+
Table("package_version").
240+
Where(builder.Eq{"creator_id": creatorID}).
241+
Join("INNER", "package_file", "package_version.id = package_file.version_id").
242+
Join("INNER", "package_blob", "package_blob.id = package_file.blob_id").
243+
SumInt(new(PackageBlob), "size")
244+
}

0 commit comments

Comments
 (0)