File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ func main() {
341341 continue
342342 }
343343 entries = append (entries , Entry {
344- ID : "link/" + url .QueryEscape (line ),
344+ ID : "link/" + url .PathEscape (line ),
345345 Type : "link" ,
346346 Content : line ,
347347 Filename : line ,
@@ -715,12 +715,8 @@ func main() {
715715 }
716716 id := strings .TrimPrefix (r .URL .Path , "/delete/" )
717717 // Handle link deletion
718- if strings .HasPrefix (id , "link/" ) {
719- linkToDelete , err := url .QueryUnescape (strings .TrimPrefix (id , "link/" ))
720- if err != nil {
721- http .Error (w , "Invalid link format for deletion" , http .StatusBadRequest )
722- return
723- }
718+ if after , ok := strings .CutPrefix (id , "link/" ); ok {
719+ linkToDelete := after
724720 linksFilePath := filepath .Join ("data" , "links.file" )
725721 data , err := os .ReadFile (linksFilePath )
726722 if err != nil {
You can’t perform that action at this time.
0 commit comments