diff --git a/server/internal/api/publink/publink.go b/server/internal/api/publink/publink.go index e27c82ca..3356eb88 100644 --- a/server/internal/api/publink/publink.go +++ b/server/internal/api/publink/publink.go @@ -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) diff --git a/server/internal/core/filesystem_readonly.go b/server/internal/core/filesystem_readonly.go index 95f90653..ca3307c1 100644 --- a/server/internal/core/filesystem_readonly.go +++ b/server/internal/core/filesystem_readonly.go @@ -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 {