mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-06 03:31:02 -06:00
[server] Fix publink not found error
This commit is contained in:
@@ -20,7 +20,7 @@ func Setup(r *gin.RouterGroup) {
|
||||
if errors.Is(err, core.ErrInsufficientPermissions) {
|
||||
c.Header("WWW-Authenticate", "Basic realm=\""+id+"\"")
|
||||
c.AbortWithStatus(http.StatusUnauthorized)
|
||||
} else if errors.Is(err, core.ErrResourceNotFound) {
|
||||
} else if errors.Is(err, core.ErrParentNotFound) {
|
||||
c.AbortWithStatus(http.StatusNotFound)
|
||||
} else {
|
||||
c.AbortWithStatus(http.StatusInternalServerError)
|
||||
|
||||
@@ -3,6 +3,7 @@ package core
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"codeberg.org/shroff/phylum/server/internal/auth/crypt"
|
||||
@@ -33,6 +34,7 @@ func (f proxyFileSystemReadOnly) Walk(r Resource, depth int, fn func(Resource, s
|
||||
|
||||
func OpenFileSystemFromPublink(ctx context.Context, id string, password string) (ReadFileSystem, error) {
|
||||
d := db.Get(ctx)
|
||||
fmt.Println(id)
|
||||
link, err := getPublink(d, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -74,7 +76,7 @@ func OpenFileSystemFromPublink(ctx context.Context, id string, password string)
|
||||
}
|
||||
|
||||
func getPublink(d db.Handler, id string) (Publink, error) {
|
||||
q := "SELECT * FROM publinks p WHERE id = $1::TEXT"
|
||||
q := "SELECT * FROM publinks WHERE id = $1::TEXT"
|
||||
if rows, err := d.Query(q, id); err != nil {
|
||||
return Publink{}, err
|
||||
} else if link, err := pgx.CollectExactlyOneRow(rows, scanPublink); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user