88 "path"
99 "strings"
1010
11- "github.com/git-pkgs/proxy/internal/archive "
11+ "github.com/git-pkgs/archives "
1212 "github.com/git-pkgs/proxy/internal/database"
1313 "github.com/git-pkgs/proxy/internal/diff"
1414 "github.com/go-chi/chi/v5"
@@ -25,13 +25,13 @@ func getStripPrefix(ecosystem string) string {
2525 }
2626}
2727
28- // BrowseListResponse contains the file listing for a directory in an archive .
28+ // BrowseListResponse contains the file listing for a directory in an archives .
2929type BrowseListResponse struct {
3030 Path string `json:"path"`
3131 Files []BrowseFileInfo `json:"files"`
3232}
3333
34- // BrowseFileInfo contains metadata about a file in an archive .
34+ // BrowseFileInfo contains metadata about a file in an archives .
3535type BrowseFileInfo struct {
3636 Path string `json:"path"`
3737 Name string `json:"name"`
@@ -82,17 +82,17 @@ func (s *Server) handleBrowseList(w http.ResponseWriter, r *http.Request) {
8282 http .Error (w , "failed to read artifact" , http .StatusInternalServerError )
8383 return
8484 }
85- defer artifactReader .Close ()
85+ defer func () { _ = artifactReader .Close () } ()
8686
8787 // Open archive with appropriate prefix stripping
8888 stripPrefix := getStripPrefix (ecosystem )
89- archiveReader , err := archive .OpenWithPrefix (cachedArtifact .Filename , artifactReader , stripPrefix )
89+ archiveReader , err := archives .OpenWithPrefix (cachedArtifact .Filename , artifactReader , stripPrefix )
9090 if err != nil {
9191 s .logger .Error ("failed to open archive" , "error" , err , "filename" , cachedArtifact .Filename )
9292 http .Error (w , "failed to open archive" , http .StatusInternalServerError )
9393 return
9494 }
95- defer archiveReader .Close ()
95+ defer func () { _ = archiveReader .Close () } ()
9696
9797 // List files in the directory
9898 files , err := archiveReader .ListDir (dirPath )
@@ -119,7 +119,7 @@ func (s *Server) handleBrowseList(w http.ResponseWriter, r *http.Request) {
119119 }
120120
121121 w .Header ().Set ("Content-Type" , "application/json" )
122- json .NewEncoder (w ).Encode (response )
122+ _ = json .NewEncoder (w ).Encode (response )
123123}
124124
125125// handleBrowseFile returns the contents of a specific file within an archived package version.
@@ -170,17 +170,17 @@ func (s *Server) handleBrowseFile(w http.ResponseWriter, r *http.Request) {
170170 http .Error (w , "failed to read artifact" , http .StatusInternalServerError )
171171 return
172172 }
173- defer artifactReader .Close ()
173+ defer func () { _ = artifactReader .Close () } ()
174174
175175 // Open archive with appropriate prefix stripping
176176 stripPrefix := getStripPrefix (ecosystem )
177- archiveReader , err := archive .OpenWithPrefix (cachedArtifact .Filename , artifactReader , stripPrefix )
177+ archiveReader , err := archives .OpenWithPrefix (cachedArtifact .Filename , artifactReader , stripPrefix )
178178 if err != nil {
179179 s .logger .Error ("failed to open archive" , "error" , err , "filename" , cachedArtifact .Filename )
180180 http .Error (w , "failed to open archive" , http .StatusInternalServerError )
181181 return
182182 }
183- defer archiveReader .Close ()
183+ defer func () { _ = archiveReader .Close () } ()
184184
185185 // Extract the file
186186 fileReader , err := archiveReader .Extract (filePath )
@@ -193,7 +193,7 @@ func (s *Server) handleBrowseFile(w http.ResponseWriter, r *http.Request) {
193193 http .Error (w , "failed to extract file" , http .StatusInternalServerError )
194194 return
195195 }
196- defer fileReader .Close ()
196+ defer func () { _ = fileReader .Close () } ()
197197
198198 // Set content type based on file extension
199199 contentType := detectContentType (filePath )
@@ -204,7 +204,7 @@ func (s *Server) handleBrowseFile(w http.ResponseWriter, r *http.Request) {
204204 w .Header ().Set ("Content-Disposition" , fmt .Sprintf ("inline; filename=%q" , filename ))
205205
206206 // Stream the file
207- io .Copy (w , fileReader )
207+ _ , _ = io .Copy (w , fileReader )
208208}
209209
210210// detectContentType returns an appropriate content type based on file extension.
@@ -387,33 +387,33 @@ func (s *Server) handleCompareDiff(w http.ResponseWriter, r *http.Request) {
387387 http .Error (w , "failed to read from version" , http .StatusInternalServerError )
388388 return
389389 }
390- defer fromReader .Close ()
390+ defer func () { _ = fromReader .Close () } ()
391391
392392 toReader , err := s .storage .Open (r .Context (), toArtifact .StoragePath .String )
393393 if err != nil {
394394 s .logger .Error ("failed to open to artifact" , "error" , err )
395395 http .Error (w , "failed to read to version" , http .StatusInternalServerError )
396396 return
397397 }
398- defer toReader .Close ()
398+ defer func () { _ = toReader .Close () } ()
399399
400400 stripPrefix := getStripPrefix (ecosystem )
401401
402- fromArchive , err := archive .OpenWithPrefix (fromArtifact .Filename , fromReader , stripPrefix )
402+ fromArchive , err := archives .OpenWithPrefix (fromArtifact .Filename , fromReader , stripPrefix )
403403 if err != nil {
404404 s .logger .Error ("failed to open from archive" , "error" , err )
405405 http .Error (w , "failed to open from archive" , http .StatusInternalServerError )
406406 return
407407 }
408- defer fromArchive .Close ()
408+ defer func () { _ = fromArchive .Close () } ()
409409
410- toArchive , err := archive .OpenWithPrefix (toArtifact .Filename , toReader , stripPrefix )
410+ toArchive , err := archives .OpenWithPrefix (toArtifact .Filename , toReader , stripPrefix )
411411 if err != nil {
412412 s .logger .Error ("failed to open to archive" , "error" , err )
413413 http .Error (w , "failed to open to archive" , http .StatusInternalServerError )
414414 return
415415 }
416- defer toArchive .Close ()
416+ defer func () { _ = toArchive .Close () } ()
417417
418418 // Generate diff
419419 result , err := diff .Compare (fromArchive , toArchive )
@@ -424,7 +424,7 @@ func (s *Server) handleCompareDiff(w http.ResponseWriter, r *http.Request) {
424424 }
425425
426426 w .Header ().Set ("Content-Type" , "application/json" )
427- json .NewEncoder (w ).Encode (result )
427+ _ = json .NewEncoder (w ).Encode (result )
428428}
429429
430430// ComparePageData contains data for the version comparison page.
0 commit comments