Skip to content

Commit 207bc26

Browse files
committed
updated
1 parent 455ef2e commit 207bc26

File tree

5 files changed

+28
-19
lines changed

5 files changed

+28
-19
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. For commit
99
- oidc groups header updates admin permission of existing user (either add/remove if role exists)'
1010
- builds amd64 binary with musl for compatibility (glic error) https://github.com/gtsteffaniak/filebrowser/issues/755
1111
- renamed `server.sources.config.disabled` to `server.sources.config.disableIndexing`
12+
- better support for running with disabled index.
1213
- small indexing behavior tweaks.
1314
- markdown viewer hides sidebar https://github.com/gtsteffaniak/filebrowser/issues/744
1415

@@ -17,6 +18,8 @@ All notable changes to this project will be documented in this file. For commit
1718
- search result links not working with custom baseUrl https://github.com/gtsteffaniak/filebrowser/issues/746
1819
- preview error for office native preview https://github.com/gtsteffaniak/filebrowser/issues/744
1920
- more source name safety for special characters.
21+
- shares with special character errors https://github.com/gtsteffaniak/filebrowser/issues/753
22+
- backspace navigates back a page when typing https://github.com/gtsteffaniak/filebrowser/issues/663
2023

2124
## v0.7.8-beta
2225

backend/http/raw.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ func addFile(path string, d *requestContext, tarWriter *tar.Writer, zipWriter *z
6262
source := splitFile[0]
6363
path = splitFile[1]
6464
var err error
65+
source, err = url.QueryUnescape(source)
66+
if err != nil {
67+
return fmt.Errorf("invalid source encoding: %v", err)
68+
}
69+
fmt.Println("source", source)
6570
userScope := "/"
6671
if d.user.Username != "publicUser" {
6772
userScope, err = settings.GetScopeFromSourceName(d.user.Scopes, source)
@@ -188,8 +193,13 @@ func rawFilesHandler(w http.ResponseWriter, r *http.Request, d *requestContext,
188193

189194
firstFileSource := splitFile[0]
190195
firstFilePath := splitFile[1]
191-
fileName := filepath.Base(firstFilePath)
196+
// decode url encoded source name
192197
var err error
198+
firstFileSource, err = url.QueryUnescape(firstFileSource)
199+
if err != nil {
200+
return http.StatusBadRequest, fmt.Errorf("invalid source encoding: %v", err)
201+
}
202+
fileName := filepath.Base(firstFilePath)
193203
userscope := "/"
194204
if d.user.Username != "publicUser" {
195205
userscope, err = settings.GetScopeFromSourceName(d.user.Scopes, firstFileSource)
@@ -323,11 +333,15 @@ func computeArchiveSize(fileList []string, d *requestContext) (int64, error) {
323333
}
324334
source := splitFile[0]
325335
path := splitFile[1]
336+
var err error
337+
source, err = url.QueryUnescape(source)
338+
if err != nil {
339+
return http.StatusBadRequest, fmt.Errorf("invalid source encoding: %v", err)
340+
}
326341
idx := indexing.GetIndex(source)
327342
if idx == nil {
328343
return 0, fmt.Errorf("source %s is not available", source)
329344
}
330-
var err error
331345
userScope := "/"
332346
if d.user.Username != "publicUser" {
333347
userScope, err = settings.GetScopeFromSourceName(d.user.Scopes, source)
@@ -342,7 +356,10 @@ func computeArchiveSize(fileList []string, d *requestContext) (int64, error) {
342356
indexPath := idx.MakeIndexPath(realPath)
343357
info, ok := idx.GetReducedMetadata(indexPath, isDir)
344358
if !ok {
345-
return 0, fmt.Errorf("failed to get metadata info for %s", path)
359+
info, err = idx.GetFsDirInfo(indexPath)
360+
if err != nil {
361+
return 0, fmt.Errorf("failed to get file info for %s : %v", path, err)
362+
}
346363
}
347364
estimatedSize += info.Size
348365
}

backend/http/share.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ func shareGetHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
6969
source := r.URL.Query().Get("source")
7070
if source == "" {
7171
source = settings.Config.Server.DefaultSource.Name
72-
} else {
73-
var err error
74-
// decode url encoded source name
75-
source, err = url.QueryUnescape(source)
76-
if err != nil {
77-
return http.StatusBadRequest, fmt.Errorf("invalid source encoding: %v", err)
78-
}
7972
}
8073
// Decode the URL-encoded path
8174
path, err := url.QueryUnescape(encodedPath)
@@ -199,13 +192,6 @@ func sharePostHandler(w http.ResponseWriter, r *http.Request, d *requestContext)
199192
sourceName := r.URL.Query().Get("source")
200193
if sourceName == "" {
201194
sourceName = config.Server.DefaultSource.Name
202-
} else {
203-
var err error
204-
// decode url encoded source name
205-
sourceName, err = url.QueryUnescape(sourceName)
206-
if err != nil {
207-
return http.StatusBadRequest, fmt.Errorf("invalid source encoding: %v", err)
208-
}
209195
}
210196
source := config.Server.NameToSource[sourceName]
211197

frontend/src/api/share.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function list() {
1010

1111
export async function get(path, source) {
1212
try {
13-
const params = { path, source };
13+
const params = { path: encodeURIComponent(path), source: encodeURIComponent(source) };
1414
const apiPath = getApiPath("api/share",params);
1515
let data = fetchJSON(apiPath);
1616
return adjustedData(data, path);
@@ -29,7 +29,7 @@ export async function remove(hash) {
2929
}
3030

3131
export async function create(path, source, password = "", expires = "", unit = "hours") {
32-
const params = { path: encodeURIComponent(path), source: source };
32+
const params = { path: encodeURIComponent(path), source: encodeURIComponent(source) };
3333
const apiPath = getApiPath("api/share",params);
3434
let body = "{}";
3535
if (password != "" || expires !== "" || unit !== "hours") {

frontend/src/views/files/ListingView.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ export default {
608608
break;
609609
610610
case "Backspace":
611+
if (getters.CurrentPromptName !== null) {
612+
return;
613+
}
611614
// go back
612615
router.push({ path: newPath });
613616
break;

0 commit comments

Comments
 (0)