From 74ccfab0703632e3535f547f6afc2c4cbb700ac1 Mon Sep 17 00:00:00 2001 From: Graham Steffaniak <42989099+gtsteffaniak@users.noreply.github.com> Date: Sat, 24 Aug 2024 19:12:47 -0500 Subject: [PATCH] Update search behavior (#195) --- .github/workflows/main.yaml | 7 +++ backend/files/file.go | 1 - backend/files/search.go | 2 +- backend/http/raw.go | 2 - backend/http/resource.go | 1 - frontend/src/api/search.js | 5 -- frontend/src/components/Search.vue | 54 ++++--------------- .../src/components/files/ExtendedImage.vue | 1 - frontend/src/components/sidebar/General.vue | 2 +- frontend/src/router/index.ts | 1 + 10 files changed, 20 insertions(+), 56 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1ebb49d3..13233b09 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -26,6 +26,13 @@ jobs: uses: docker/metadata-action@v5 with: images: gtstef/filebrowser + - name: Get latest release tag and commit SHA + id: get_tag_and_sha + run: | + latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) + latest_commit=$(git rev-list -n 1 $latest_tag) + echo "latest_tag=${latest_tag}" >> $GITHUB_ENV + echo "latest_commit=${latest_commit}" >> $GITHUB_ENV - name: Build and push uses: docker/build-push-action@v5 with: diff --git a/backend/files/file.go b/backend/files/file.go index 96b2e3f9..5cfa358f 100644 --- a/backend/files/file.go +++ b/backend/files/file.go @@ -360,7 +360,6 @@ func resolveSymlinks(path string) (string, error) { // addContent reads and sets content based on the file type. func (i *FileInfo) addContent(path string) error { if !i.IsDir { - fmt.Println("getting content for ", path) content, err := os.ReadFile(path) if err != nil { return err diff --git a/backend/files/search.go b/backend/files/search.go index 2333838a..13a0d3b5 100644 --- a/backend/files/search.go +++ b/backend/files/search.go @@ -65,7 +65,7 @@ func (si *Index) Search(search string, scope string, sourceSession string) ([]st if count > maxSearchResults { break } - fullName := pathName + file + fullName := strings.TrimLeft(pathName+file, "/") fileTypes := map[string]bool{} matches, fileType := containsSearchTerm(fullName, searchTerm, *searchOptions, isDir, fileTypes) diff --git a/backend/http/raw.go b/backend/http/raw.go index a3938889..ad44178f 100644 --- a/backend/http/raw.go +++ b/backend/http/raw.go @@ -2,7 +2,6 @@ package http import ( "errors" - "fmt" "log" "net/http" "net/url" @@ -86,7 +85,6 @@ var rawHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *data) if err != nil { return http.StatusInternalServerError, err } - fmt.Println("realpath", realPath, err) file, err := files.FileInfoFaster(files.FileOptions{ Path: realPath, Modify: d.user.Perm.Modify, diff --git a/backend/http/resource.go b/backend/http/resource.go index 32462442..9fb79050 100644 --- a/backend/http/resource.go +++ b/backend/http/resource.go @@ -152,7 +152,6 @@ var resourcePutHandler = withUser(func(w http.ResponseWriter, r *http.Request, d ReadHeader: d.server.TypeDetectionByHeader, Checker: d, } - fmt.Println("realPath", realPath) err = files.WriteFile(fileOpts, r.Body) return errToStatus(err), err }) diff --git a/frontend/src/api/search.js b/frontend/src/api/search.js index 42846880..d9acacea 100644 --- a/frontend/src/api/search.js +++ b/frontend/src/api/search.js @@ -15,11 +15,6 @@ export default async function search(base, query) { data = data.map((item) => { item.url = `/files${base}` + url.encodePath(item.path); - - if (item.dir) { - item.url += "/"; - } - return item; }); diff --git a/frontend/src/components/Search.vue b/frontend/src/components/Search.vue index ae3d105c..cda36b85 100644 --- a/frontend/src/components/Search.vue +++ b/frontend/src/components/Search.vue @@ -1,7 +1,7 @@