forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/go-gitea/gitea
* 'main' of https://github.com/go-gitea/gitea: Add packagist webhook (go-gitea#18224) Fix mime-type detection for HTTP server (go-gitea#18370) Always use git command but not os.Command (go-gitea#18363) Add deprecated for LFS_CONTENT_PATH on zh-cn docs (go-gitea#18362) [skip ci] Updated translations via Crowdin Make gitea, gitea-vet future-proof (go-gitea#18361) Pause queues (go-gitea#15928) Disable content sniffing on `PlainTextBytes` (go-gitea#18359) Update github.com/duo-labs/webauthn (go-gitea#18357)
- Loading branch information
Showing
67 changed files
with
1,964 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,6 @@ Gitea 的存储 webhook。这可以有存储库管路设定页 `/:username/:repo | |
- Microsoft Teams | ||
- Feishu | ||
- Wechatwork | ||
- Packagist | ||
|
||
## TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ Gitea 的儲存庫事件支援 web hook。這可以有儲存庫管理員在設 | |
- Microsoft Teams | ||
- Feishu | ||
- Wechatwork | ||
- Packagist | ||
|
||
### 事件資訊 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
package json | ||
|
||
// Allow "encoding/json" import. | ||
import ( | ||
"bytes" | ||
"encoding/binary" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2022 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package public | ||
|
||
import "strings" | ||
|
||
// wellKnownMimeTypesLower comes from Golang's builtin mime package: `builtinTypesLower`, see the comment of detectWellKnownMimeType | ||
var wellKnownMimeTypesLower = map[string]string{ | ||
".avif": "image/avif", | ||
".css": "text/css; charset=utf-8", | ||
".gif": "image/gif", | ||
".htm": "text/html; charset=utf-8", | ||
".html": "text/html; charset=utf-8", | ||
".jpeg": "image/jpeg", | ||
".jpg": "image/jpeg", | ||
".js": "text/javascript; charset=utf-8", | ||
".json": "application/json", | ||
".mjs": "text/javascript; charset=utf-8", | ||
".pdf": "application/pdf", | ||
".png": "image/png", | ||
".svg": "image/svg+xml", | ||
".wasm": "application/wasm", | ||
".webp": "image/webp", | ||
".xml": "text/xml; charset=utf-8", | ||
|
||
// well, there are some types missing from the builtin list | ||
".txt": "text/plain; charset=utf-8", | ||
} | ||
|
||
// detectWellKnownMimeType will return the mime-type for a well-known file ext name | ||
// The purpose of this function is to bypass the unstable behavior of Golang's mime.TypeByExtension | ||
// mime.TypeByExtension would use OS's mime-type config to overwrite the well-known types (see its document). | ||
// If the user's OS has incorrect mime-type config, it would make Gitea can not respond a correct Content-Type to browsers. | ||
// For example, if Gitea returns `text/plain` for a `.js` file, the browser couldn't run the JS due to security reasons. | ||
// detectWellKnownMimeType makes the Content-Type for well-known files stable. | ||
func detectWellKnownMimeType(ext string) string { | ||
ext = strings.ToLower(ext) | ||
return wellKnownMimeTypesLower[ext] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.