mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 11:07:18 -04:00 
			
		
		
		
	Update allowed attachment types (#29688)
Update to match GitHub's latest. Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
		| @@ -832,7 +832,7 @@ Default templates for project boards: | |||||||
| ## Issue and pull request attachments (`attachment`) | ## Issue and pull request attachments (`attachment`) | ||||||
|  |  | ||||||
| - `ENABLED`: **true**: Whether issue and pull request attachments are enabled. | - `ENABLED`: **true**: Whether issue and pull request attachments are enabled. | ||||||
| - `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. | - `ALLOWED_TYPES`: **.cpuprofile,.csv,.dmp,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.json,.jsonc,.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. | ||||||
| - `MAX_SIZE`: **2048**: Maximum size (MB). | - `MAX_SIZE`: **2048**: Maximum size (MB). | ||||||
| - `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once. | - `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once. | ||||||
| - `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]` | - `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]` | ||||||
|   | |||||||
| @@ -782,7 +782,7 @@ Gitea 创建以下非唯一队列: | |||||||
| ## 工单和合并请求的附件 (`attachment`) | ## 工单和合并请求的附件 (`attachment`) | ||||||
|  |  | ||||||
| - `ENABLED`: **true**: 是否允许用户上传附件。 | - `ENABLED`: **true**: 是否允许用户上传附件。 | ||||||
| - `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/*`)的逗号分隔列表。空值或 `*/*` 允许所有类型。 | - `ALLOWED_TYPES`: **.cpuprofile,.csv,.dmp,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.json,.jsonc,.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/*`)的逗号分隔列表。空值或 `*/*` 允许所有类型。 | ||||||
| - `MAX_SIZE`: **2048**: 附件的最大限制(MB)。 | - `MAX_SIZE`: **2048**: 附件的最大限制(MB)。 | ||||||
| - `MAX_FILES`: **5**: 一次最多上传的附件数量。 | - `MAX_FILES`: **5**: 一次最多上传的附件数量。 | ||||||
| - `STORAGE_TYPE`: **local**: 附件的存储类型,`local` 表示本地磁盘,`minio` 表示兼容 S3 的对象存储服务,如果未设置将使用默认值 `local` 或其他在 `[storage.xxx]` 中定义的名称。 | - `STORAGE_TYPE`: **local**: 附件的存储类型,`local` 表示本地磁盘,`minio` 表示兼容 S3 的对象存储服务,如果未设置将使用默认值 `local` 或其他在 `[storage.xxx]` 中定义的名称。 | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ var Attachment = struct { | |||||||
| 	Enabled      bool | 	Enabled      bool | ||||||
| }{ | }{ | ||||||
| 	Storage:      &Storage{}, | 	Storage:      &Storage{}, | ||||||
| 	AllowedTypes: ".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", | 	AllowedTypes: ".cpuprofile,.csv,.dmp,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.json,.jsonc,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip", | ||||||
| 	MaxSize:      2048, | 	MaxSize:      2048, | ||||||
| 	MaxFiles:     5, | 	MaxFiles:     5, | ||||||
| 	Enabled:      true, | 	Enabled:      true, | ||||||
| @@ -25,7 +25,7 @@ func loadAttachmentFrom(rootCfg ConfigProvider) (err error) { | |||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	Attachment.AllowedTypes = sec.Key("ALLOWED_TYPES").MustString(".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") | 	Attachment.AllowedTypes = sec.Key("ALLOWED_TYPES").MustString(".cpuprofile,.csv,.dmp,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.json,.jsonc,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip") | ||||||
| 	Attachment.MaxSize = sec.Key("MAX_SIZE").MustInt64(2048) | 	Attachment.MaxSize = sec.Key("MAX_SIZE").MustInt64(2048) | ||||||
| 	Attachment.MaxFiles = sec.Key("MAX_FILES").MustInt(5) | 	Attachment.MaxFiles = sec.Key("MAX_FILES").MustInt(5) | ||||||
| 	Attachment.Enabled = sec.Key("ENABLED").MustBool(true) | 	Attachment.Enabled = sec.Key("ENABLED").MustBool(true) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user