Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
check for /files suffix in API path for dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
blankdots committed Nov 13, 2023
1 parent 0928c90 commit d6d347f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/sda/sda.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ var getFiles = func(datasetID string, ctx *gin.Context) ([]*database.FileInfo, i
// Files serves a list of files belonging to a dataset
func Files(c *gin.Context) {

if !strings.HasSuffix(dataset, "/files") {

Check failure on line 86 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Build and test (1.20)

undefined: dataset

Check failure on line 86 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

undefined: dataset

Check failure on line 86 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

undefined: dataset

Check failure on line 86 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

undefined: dataset
return nil, 404, errors.New("API path not found, maybe /files is missing")

Check failure on line 87 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Build and test (1.20)

too many return values

Check failure on line 87 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

too many return values

Check failure on line 87 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

too many return values

Check failure on line 87 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

too many return values
}

// get dataset parameter, remove / prefix and /files suffix
dataset := c.Param("dataset")
dataset = strings.TrimPrefix(dataset, "/")
Expand Down

0 comments on commit d6d347f

Please sign in to comment.