Skip to content

Commit 6c9bf21

Browse files
committed
Merge branch 'main' into static
* main: Refactor "Content" for file uploading (go-gitea#25851) Fix SSPI auth panic (go-gitea#25955) Make pending commit status yellow again (go-gitea#25935) Move public asset files to the proper directory (go-gitea#25907) Disallow dangerous url schemes (go-gitea#25960) Avoid creating directories when loading config (go-gitea#25944) [skip ci] Updated translations via Crowdin
2 parents 67a46fd + 236c645 commit 6c9bf21

File tree

441 files changed

+278
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

441 files changed

+278
-240
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ cpu.out
7575
/yarn.lock
7676
/yarn-error.log
7777
/npm-debug.log*
78-
/public/static
78+
/public/assets/static
7979
/vendor
8080
/web_src/fomantic/node_modules
8181
/web_src/fomantic/build/*

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
* text=auto eol=lf
22
*.tmpl linguist-language=Handlebars
33
/assets/*.json linguist-generated
4-
/public/img/svg/*.svg linguist-generated
4+
/public/assets/img/svg/*.svg linguist-generated
55
/templates/swagger/v1_json.tmpl linguist-generated
66
/vendor/** -text -eol linguist-vendored
77
/web_src/fomantic/build/** linguist-generated

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ cpu.out
7272
/yarn.lock
7373
/yarn-error.log
7474
/npm-debug.log*
75-
/public/static
75+
/public/assets/static
7676
/vendor
7777
/web_src/fomantic/node_modules
7878
/web_src/fomantic/build/*

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ FOMANTIC_WORK_DIR := web_src/fomantic
116116

117117
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
118118
WEBPACK_CONFIGS := webpack.config.js
119-
WEBPACK_DEST := public/static/index.js public/static/index.css
120-
WEBPACK_DEST_ENTRIES := public/static
119+
WEBPACK_DEST := public/assets/static/index.js public/assets/static/index.css
120+
WEBPACK_DEST_ENTRIES := public/assets/static
121121

122122
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
123123
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
124124

125125
GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go
126126

127-
SVG_DEST_DIR := public/img/svg
127+
SVG_DEST_DIR := public/assets/img/svg
128128

129129
AIR_TMP_DIR := .air
130130

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<a href="https://gitea.io/">
3-
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/img/gitea.svg" width="220"/>
3+
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/assets/img/gitea.svg" width="220"/>
44
</a>
55
</p>
66
<h1 align="center">Gitea - Git with a cup of tea</h1>

README_ZH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<a href="https://gitea.io/">
3-
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/img/gitea.svg" width="220"/>
3+
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/assets/img/gitea.svg" width="220"/>
44
</a>
55
</p>
66
<h1 align="center">Gitea - Git with a cup of tea</h1>

build/generate-images.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ async function main() {
6969
const faviconSvg = await readFile(new URL('../assets/favicon.svg', import.meta.url), 'utf8');
7070

7171
await Promise.all([
72-
generate(logoSvg, '../public/img/logo.svg', {size: 32}),
73-
generate(logoSvg, '../public/img/logo.png', {size: 512}),
74-
generate(faviconSvg, '../public/img/favicon.svg', {size: 32}),
75-
generate(faviconSvg, '../public/img/favicon.png', {size: 180}),
76-
generate(logoSvg, '../public/img/avatar_default.png', {size: 200}),
77-
generate(logoSvg, '../public/img/apple-touch-icon.png', {size: 180, bg: true}),
78-
gitea && generate(logoSvg, '../public/img/gitea.svg', {size: 32}),
72+
generate(logoSvg, '../public/assets/img/logo.svg', {size: 32}),
73+
generate(logoSvg, '../public/assets/img/logo.png', {size: 512}),
74+
generate(faviconSvg, '../public/assets/img/favicon.svg', {size: 32}),
75+
generate(faviconSvg, '../public/assets/img/favicon.png', {size: 180}),
76+
generate(logoSvg, '../public/assets/img/avatar_default.png', {size: 200}),
77+
generate(logoSvg, '../public/assets/img/apple-touch-icon.png', {size: 180, bg: true}),
78+
gitea && generate(logoSvg, '../public/assets/img/gitea.svg', {size: 32}),
7979
]);
8080
}
8181

build/generate-svg.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async function processFile(file, {prefix, fullName} = {}) {
4444
],
4545
});
4646

47-
await writeFile(fileURLToPath(new URL(`../public/img/svg/${name}.svg`, import.meta.url)), data);
47+
await writeFile(fileURLToPath(new URL(`../public/assets/img/svg/${name}.svg`, import.meta.url)), data);
4848
}
4949

5050
function processFiles(pattern, opts) {
@@ -53,13 +53,13 @@ function processFiles(pattern, opts) {
5353

5454
async function main() {
5555
try {
56-
await mkdir(fileURLToPath(new URL('../public/img/svg', import.meta.url)), {recursive: true});
56+
await mkdir(fileURLToPath(new URL('../public/assets/img/svg', import.meta.url)), {recursive: true});
5757
} catch {}
5858

5959
await Promise.all([
6060
...processFiles('node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
6161
...processFiles('web_src/svg/*.svg'),
62-
...processFiles('public/img/gitea.svg', {fullName: 'gitea-gitea'}),
62+
...processFiles('public/assets/img/gitea.svg', {fullName: 'gitea-gitea'}),
6363
]);
6464
}
6565

custom/conf/app.example.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,11 +1200,11 @@ LEVEL = Info
12001200
;;
12011201
;; All available reactions users can choose on issues/prs and comments.
12021202
;; Values can be emoji alias (:smile:) or a unicode emoji.
1203-
;; For custom reactions, add a tightly cropped square image to public/img/emoji/reaction_name.png
1203+
;; For custom reactions, add a tightly cropped square image to public/assets/img/emoji/reaction_name.png
12041204
;REACTIONS = +1, -1, laugh, hooray, confused, heart, rocket, eyes
12051205
;;
12061206
;; Additional Emojis not defined in the utf8 standard
1207-
;; By default we support gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and add it to this config.
1207+
;; By default we support gitea (:gitea:), to add more copy them to public/assets/img/emoji/emoji_name.png and add it to this config.
12081208
;; Dont mistake it for Reactions.
12091209
;CUSTOM_EMOJIS = gitea, codeberg, gitlab, git, github, gogs
12101210
;;

docs/content/doc/administration/cmd-embedded.en-us.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ for its glob syntax. Here are some examples:
4747

4848
- List all template files, in any virtual directory: `**.tmpl`
4949
- List all mail template files: `templates/mail/**.tmpl`
50-
- List all files inside `public/img`: `public/img/**`
50+
- List all files inside `public/assets/img`: `public/assets/img/**`
5151

5252
Don't forget to use quotes for the patterns, as spaces, `*` and other characters might have
5353
a special meaning for your command shell.
@@ -60,8 +60,8 @@ Listing all embedded files with `openid` in their path:
6060

6161
```sh
6262
$ gitea embedded list '**openid**'
63-
public/img/auth/openid_connect.svg
64-
public/img/openid-16x16.png
63+
public/assets/img/auth/openid_connect.svg
64+
public/assets/img/openid-16x16.png
6565
templates/user/auth/finalize_openid.tmpl
6666
templates/user/auth/signin_openid.tmpl
6767
templates/user/auth/signup_openid_connect.tmpl

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a
224224
- `MAX_DISPLAY_FILE_SIZE`: **8388608**: Max size of files to be displayed (default is 8MiB)
225225
- `REACTIONS`: All available reactions users can choose on issues/prs and comments
226226
Values can be emoji alias (:smile:) or a unicode emoji.
227-
For custom reactions, add a tightly cropped square image to public/img/emoji/reaction_name.png
227+
For custom reactions, add a tightly cropped square image to public/assets/img/emoji/reaction_name.png
228228
- `CUSTOM_EMOJIS`: **gitea, codeberg, gitlab, git, github, gogs**: Additional Emojis not defined in the utf8 standard.
229-
By default, we support Gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and
229+
By default, we support Gitea (:gitea:), to add more copy them to public/assets/img/emoji/emoji_name.png and
230230
add it to this config.
231231
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
232232
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.

docs/content/doc/administration/customizing-gitea.en-us.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,22 @@ is set under the "Configuration" tab on the site administration page.
5656

5757
To make Gitea serve custom public files (like pages and images), use the folder
5858
`$GITEA_CUSTOM/public/` as the webroot. Symbolic links will be followed.
59+
At the moment, only files in the `public/assets/` folder are served.
5960

60-
For example, a file `image.png` stored in `$GITEA_CUSTOM/public/`, can be accessed with
61+
For example, a file `image.png` stored in `$GITEA_CUSTOM/public/assets/`, can be accessed with
6162
the url `http://gitea.domain.tld/assets/image.png`.
6263

6364
## Changing the logo
6465

6566
To build a custom logo and/or favicon clone the Gitea source repository, replace `assets/logo.svg` and/or `assets/favicon.svg` and run
66-
`make generate-images`. `assets/favicon.svg` is used for the favicon only. This will update below output files which you can then place in `$GITEA_CUSTOM/public/img` on your server:
67+
`make generate-images`. `assets/favicon.svg` is used for the favicon only. This will update below output files which you can then place in `$GITEA_CUSTOM/public/assets/img` on your server:
6768

68-
- `public/img/logo.svg` - Used for site icon, app icon
69-
- `public/img/logo.png` - Used for Open Graph
70-
- `public/img/avatar_default.png` - Used as the default avatar image
71-
- `public/img/apple-touch-icon.png` - Used on iOS devices for bookmarks
72-
- `public/img/favicon.svg` - Used for favicon
73-
- `public/img/favicon.png` - Used as fallback for browsers that don't support SVG favicons
69+
- `public/assets/img/logo.svg` - Used for site icon, app icon
70+
- `public/assets/img/logo.png` - Used for Open Graph
71+
- `public/assets/img/avatar_default.png` - Used as the default avatar image
72+
- `public/assets/img/apple-touch-icon.png` - Used on iOS devices for bookmarks
73+
- `public/assets/img/favicon.svg` - Used for favicon
74+
- `public/assets/img/favicon.png` - Used as fallback for browsers that don't support SVG favicons
7475

7576
In case the source image is not in vector format, you can attempt to convert a raster image using tools like [this](https://www.aconvert.com/image/png-to-svg/).
7677

@@ -102,7 +103,7 @@ Dont forget to restart your Gitea to apply the changes.
102103
If all you want is to add extra links to the top navigation bar or footer, or extra tabs to the repository view, you can put them in `extra_links.tmpl` (links added to the navbar), `extra_links_footer.tmpl` (links added to the left side of footer), and `extra_tabs.tmpl` inside your `$GITEA_CUSTOM/templates/custom/` directory.
103104

104105
For instance, let's say you are in Germany and must add the famously legally-required "Impressum"/about page, listing who is responsible for the site's content:
105-
just place it under your "$GITEA_CUSTOM/public/" directory (for instance `$GITEA_CUSTOM/public/impressum.html`) and put a link to it in either `$GITEA_CUSTOM/templates/custom/extra_links.tmpl` or `$GITEA_CUSTOM/templates/custom/extra_links_footer.tmpl`.
106+
just place it under your "$GITEA_CUSTOM/public/assets/" directory (for instance `$GITEA_CUSTOM/public/assets/impressum.html`) and put a link to it in either `$GITEA_CUSTOM/templates/custom/extra_links.tmpl` or `$GITEA_CUSTOM/templates/custom/extra_links_footer.tmpl`.
106107

107108
To match the current style, the link should have the class name "item", and you can use `{{AppSubUrl}}` to get the base URL:
108109
`<a class="item" href="{{AppSubUrl}}/assets/impressum.html">Impressum</a>`
@@ -132,7 +133,7 @@ The data is encoded and sent to the PlantUML server which generates the picture.
132133
demo server at http://www.plantuml.com/plantuml, but if you (or your users) have sensitive data you
133134
can set up your own [PlantUML server](https://plantuml.com/server) instead. To set up PlantUML rendering,
134135
copy JavaScript files from https://gitea.com/davidsvantesson/plantuml-code-highlight and put them in your
135-
`$GITEA_CUSTOM/public` folder. Then add the following to `custom/footer.tmpl`:
136+
`$GITEA_CUSTOM/public/assets/` folder. Then add the following to `custom/footer.tmpl`:
136137

137138
```html
138139
<script>
@@ -204,15 +205,16 @@ You can display STL file directly in Gitea by adding:
204205

205206
to the file `templates/custom/footer.tmpl`
206207

207-
You also need to download the content of the library [Madeleine.js](https://github.com/beige90/Madeleine.js) and place it under `$GITEA_CUSTOM/public/` folder.
208+
You also need to download the content of the library [Madeleine.js](https://github.com/beige90/Madeleine.js) and place it under `$GITEA_CUSTOM/public/assets/` folder.
208209

209210
You should end-up with a folder structure similar to:
210211

211212
```
212213
$GITEA_CUSTOM/templates
213214
-- custom
214215
`-- footer.tmpl
215-
$GITEA_CUSTOM/public
216+
217+
$GITEA_CUSTOM/public/assets/
216218
-- Madeleine.js
217219
|-- LICENSE
218220
|-- README.md
@@ -366,7 +368,7 @@ The list of themes a user can choose from can be configured with the `THEMES` va
366368
367369
To make a custom theme available to all users:
368370
369-
1. Add a CSS file to `$GITEA_CUSTOM/public/css/theme-<theme-name>.css`.
371+
1. Add a CSS file to `$GITEA_CUSTOM/public/assets/css/theme-<theme-name>.css`.
370372
The value of `$GITEA_CUSTOM` of your instance can be queried by calling `gitea help` and looking up the value of "CustomPath".
371373
2. Add `<theme-name>` to the comma-separated list of setting `THEMES` in `app.ini`
372374

docs/content/doc/administration/external-renderers.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ And so you could write some CSS:
191191
}
192192
```
193193

194-
Add your stylesheet to your custom directory e.g `custom/public/css/my-style-XXXXX.css` and import it using a custom header file `custom/templates/custom/header.tmpl`:
194+
Add your stylesheet to your custom directory e.g `custom/public/assets/css/my-style-XXXXX.css` and import it using a custom header file `custom/templates/custom/header.tmpl`:
195195

196196
```html
197197
<link rel="stylesheet" href="{{AppSubUrl}}/assets/css/my-style-XXXXX.css" />

docs/content/doc/development/hacking-on-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ REPO_INDEXER_CONN_STR = http://elastic:changeme@localhost:9200
218218

219219
### Building and adding SVGs
220220

221-
SVG icons are built using the `make svg` target which compiles the icon sources defined in `build/generate-svg.js` into the output directory `public/img/svg`. Custom icons can be added in the `web_src/svg` directory.
221+
SVG icons are built using the `make svg` target which compiles the icon sources defined in `build/generate-svg.js` into the output directory `public/assets/img/svg`. Custom icons can be added in the `web_src/svg` directory.
222222

223223
### Building the Logo
224224

docs/content/doc/help/faq.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ To add your own theme, currently the only way is to provide a complete theme (no
192192

193193
As an example, let's say our theme is `arc-blue` (this is a real theme, and can be found [in this issue](https://github.com/go-gitea/gitea/issues/6011))
194194

195-
Name the `.css` file `theme-arc-blue.css` and add it to your custom folder in `custom/public/css`
195+
Name the `.css` file `theme-arc-blue.css` and add it to your custom folder in `custom/public/assets/css`
196196

197197
Allow users to use it by adding `arc-blue` to the list of `THEMES` in your `app.ini`
198198

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ require (
7676
github.com/mattn/go-sqlite3 v1.14.17
7777
github.com/meilisearch/meilisearch-go v0.25.0
7878
github.com/mholt/archiver/v3 v3.5.1
79-
github.com/microcosm-cc/bluemonday v1.0.24
79+
github.com/microcosm-cc/bluemonday v1.0.25
8080
github.com/minio/minio-go/v7 v7.0.60
8181
github.com/minio/sha256-simd v1.0.1
8282
github.com/msteinert/pam v1.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,8 @@ github.com/mholt/acmez v1.2.0 h1:1hhLxSgY5FvH5HCnGUuwbKY2VQVo8IU7rxXKSnZ7F30=
865865
github.com/mholt/acmez v1.2.0/go.mod h1:VT9YwH1xgNX1kmYY89gY8xPJC84BFAisjo8Egigt4kE=
866866
github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=
867867
github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
868-
github.com/microcosm-cc/bluemonday v1.0.24 h1:NGQoPtwGVcbGkKfvyYk1yRqknzBuoMiUrO6R7uFTPlw=
869-
github.com/microcosm-cc/bluemonday v1.0.24/go.mod h1:ArQySAMps0790cHSkdPEJ7bGkF2VePWH773hsJNSHf8=
868+
github.com/microcosm-cc/bluemonday v1.0.25 h1:4NEwSfiJ+Wva0VxN5B8OwMicaJvD8r9tlJWm9rtloEg=
869+
github.com/microcosm-cc/bluemonday v1.0.25/go.mod h1:ZIOjCQp1OrzBBPIJmfX4qDYFuhU02nx4bn030ixfHLE=
870870
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
871871
github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo=
872872
github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY=

modules/markup/sanitizer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package markup
66

77
import (
88
"io"
9+
"net/url"
910
"regexp"
1011
"sync"
1112

@@ -79,6 +80,14 @@ func createDefaultPolicy() *bluemonday.Policy {
7980
policy.AllowURLSchemes(setting.Markdown.CustomURLSchemes...)
8081
} else {
8182
policy.AllowURLSchemesMatching(allowAllRegex)
83+
84+
// Even if every scheme is allowed, these three are blocked for security reasons
85+
disallowScheme := func(*url.URL) bool {
86+
return false
87+
}
88+
policy.AllowURLSchemeWithCustomPolicy("javascript", disallowScheme)
89+
policy.AllowURLSchemeWithCustomPolicy("vbscript", disallowScheme)
90+
policy.AllowURLSchemeWithCustomPolicy("data", disallowScheme)
8291
}
8392

8493
// Allow classes for anchors

modules/markup/sanitizer_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ func Test_Sanitizer(t *testing.T) {
5454
`<code style="bad-color: red">Hello World</code>`, `<code>Hello World</code>`,
5555

5656
// URLs
57-
`[my custom URL scheme](cbthunderlink://somebase64string)`, `[my custom URL scheme](cbthunderlink://somebase64string)`,
58-
`[my custom URL scheme](matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join)`, `[my custom URL scheme](matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join)`,
57+
`<a href="cbthunderlink://somebase64string)">my custom URL scheme</a>`, `<a href="cbthunderlink://somebase64string)" rel="nofollow">my custom URL scheme</a>`,
58+
`<a href="matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join">my custom URL scheme</a>`, `<a href="matrix:roomid/psumPMeAfzgAeQpXMG:feneas.org?action=join" rel="nofollow">my custom URL scheme</a>`,
59+
60+
// Disallow dangerous url schemes
61+
`<a href="javascript:alert('xss')">bad</a>`, `bad`,
62+
`<a href="vbscript:no">bad</a>`, `bad`,
63+
`<a href="data:1234">bad</a>`, `bad`,
5964
}
6065

6166
for i := 0; i < len(testCases); i += 2 {

modules/public/public.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func setWellKnownContentType(w http.ResponseWriter, file string) {
7373

7474
func handleRequest(w http.ResponseWriter, req *http.Request, fs http.FileSystem, file string) bool {
7575
// actually, fs (http.FileSystem) is designed to be a safe interface, relative paths won't bypass its parent directory, it's also fine to do a clean here
76-
f, err := fs.Open(util.PathJoinRelX(file))
76+
f, err := fs.Open(util.PathJoinRelX("assets", file))
7777
if err != nil {
7878
if os.IsNotExist(err) {
7979
return false

modules/setting/packages.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ func loadPackagesFrom(rootCfg ConfigProvider) (err error) {
7474
Packages.ChunkedUploadPath = filepath.ToSlash(filepath.Join(AppDataPath, Packages.ChunkedUploadPath))
7575
}
7676

77-
if err := os.MkdirAll(Packages.ChunkedUploadPath, os.ModePerm); err != nil {
78-
return fmt.Errorf("unable to create chunked upload directory: %s (%v)", Packages.ChunkedUploadPath, err)
77+
if HasInstallLock(rootCfg) {
78+
if err := os.MkdirAll(Packages.ChunkedUploadPath, os.ModePerm); err != nil {
79+
return fmt.Errorf("unable to create chunked upload directory: %s (%v)", Packages.ChunkedUploadPath, err)
80+
}
7981
}
8082

8183
Packages.LimitTotalOwnerSize = mustBytes(sec, "LIMIT_TOTAL_OWNER_SIZE")

modules/structs/repo_file.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type CreateFileOptions struct {
2626
FileOptions
2727
// content must be base64 encoded
2828
// required: true
29-
Content string `json:"content"`
29+
ContentBase64 string `json:"content"`
3030
}
3131

3232
// Branch returns branch name
@@ -54,7 +54,7 @@ type UpdateFileOptions struct {
5454
DeleteFileOptions
5555
// content must be base64 encoded
5656
// required: true
57-
Content string `json:"content"`
57+
ContentBase64 string `json:"content"`
5858
// from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
5959
FromPath string `json:"from_path" binding:"MaxSize(500)"`
6060
}
@@ -74,7 +74,7 @@ type ChangeFileOperation struct {
7474
// required: true
7575
Path string `json:"path" binding:"Required;MaxSize(500)"`
7676
// new or updated file content, must be base64 encoded
77-
Content string `json:"content"`
77+
ContentBase64 string `json:"content"`
7878
// sha is the SHA for the file that already exists, required for update or delete
7979
SHA string `json:"sha"`
8080
// old path of the file to move

modules/svg/svg.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const defaultSize = 16
2727

2828
// Init discovers SVGs and populates the `SVGs` variable
2929
func Init() error {
30-
files, err := public.AssetFS().ListFiles("img/svg")
30+
files, err := public.AssetFS().ListFiles("assets/img/svg")
3131
if err != nil {
3232
return err
3333
}
@@ -38,7 +38,7 @@ func Init() error {
3838
if path.Ext(file) != ".svg" {
3939
continue
4040
}
41-
bs, err := public.AssetFS().ReadFile("img/svg", file)
41+
bs, err := public.AssetFS().ReadFile("assets/img/svg", file)
4242
if err != nil {
4343
log.Error("Failed to read SVG file %s: %v", file, err)
4444
} else {

0 commit comments

Comments
 (0)