Skip to content

Commit 3e27a54

Browse files
authored
Merge pull request #265 from clowder-framework/release/v1.18.1
release 1.18.1
2 parents 13a9427 + 0204459 commit 3e27a54

File tree

12 files changed

+1508
-744
lines changed

12 files changed

+1508
-744
lines changed

.github/workflows/swagger.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: swagger
2+
3+
# This will run when:
4+
# - when new code is pushed to master/develop to make sure the
5+
# code does compile.
6+
# - when a pull request is created and updated to make sure the
7+
# code does compile.
8+
on:
9+
push:
10+
branches:
11+
- master
12+
- develop
13+
14+
pull_request:
15+
16+
# Check to make sure swagger document is valid
17+
jobs:
18+
19+
# downloads all the dependencies and compiles the scala code
20+
lint:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: openapi-lint
26+
uses: mhiew/redoc-lint-github-action@v2
27+
with:
28+
args: 'public/swagger.yml --skip-rule operation-operationId'

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 1.18.1 - 2021-08-16
8+
9+
This release fixes a critical issue where invalid zip files could result in the files not being uploaded correctly. To check to see if you are affected, please use the following query:
10+
11+
```
12+
db.uploads.find({"status": "CREATED", "contentType": "application/x-zip-compressed"}, {"author.fullName": 1, "author.email": 1, "filename": 1, "uploadDate": 1, "length": 1})
13+
```
14+
15+
If any files are returned, you should check to see if these files affected and are missing from clowder.
16+
17+
### Fixed
18+
- When zip file is uploaded, it will parse the file to check if it is a valid zip file, this couuld result in files not stored in final storage space [#264](https://github.com/clowder-framework/clowder/issues/264)
19+
- Updated swagger documentation
20+
- Return 404 not found when calling file/dataset/space api endpoints with an invalid ID [#251](https://github.com/clowder-framework/clowder/issues/251)
21+
- Line breaks in welcome message breaks swagger build [#187](https://github.com/clowder-framework/clowder/issues/187)
22+
23+
### Changed
24+
- Added more information when writing files to make sure files are written correctly
25+
- Made cilogon group check debug message instead of error message
26+
727
## 1.18.0 - 2021-07-08
828

929
### Added

app/api/Datasets.scala

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Datasets @Inject()(
6161
def get(id: UUID) = PermissionAction(Permission.ViewDataset, Some(ResourceRef(ResourceRef.dataset, id))) { implicit request =>
6262
datasets.get(id) match {
6363
case Some(d) => Ok(toJson(d))
64-
case None => BadRequest(toJson(s"Could not find dataset with id [${id.stringify}]"))
64+
case None => NotFound(toJson(s"Could not find dataset with id [${id.stringify}]"))
6565
}
6666
}
6767

@@ -203,11 +203,11 @@ class Datasets @Inject()(
203203
case Some(spaceId) =>
204204
spaces.get(UUID(spaceId)) match {
205205
case Some(s) => d = Dataset(name=name,description=description, created=new Date(), author=identity, licenseData = License.fromAppConfig(), spaces = List(UUID(spaceId)), stats = new Statistics())
206-
case None => BadRequest(toJson("Bad space = " + spaceId))
206+
case None => NotFound(toJson("Bad space = " + spaceId))
207207
}
208208
}
209209
}
210-
case None => InternalServerError("User Not found")
210+
case None => NotFound("User Not found")
211211
}
212212
appConfig.incrementCount('datasets, 1)
213213

@@ -248,7 +248,7 @@ class Datasets @Inject()(
248248
}
249249
case None => Ok(toJson(Map("status" -> "error")))
250250
}
251-
case None => BadRequest(toJson("Bad file_id = " + file_id))
251+
case None => NotFound(toJson("Bad file_id = " + file_id))
252252

253253
}
254254
}
@@ -556,7 +556,7 @@ class Datasets @Inject()(
556556

557557
}
558558
}
559-
case None => InternalServerError("User Not found")
559+
case None => NotFound("User Not found")
560560
}
561561
events.addObjectEvent(request.user, d.id, d.name, EventType.CREATE_DATASET.toString)
562562

@@ -599,7 +599,7 @@ class Datasets @Inject()(
599599
}
600600
case None => {
601601
Logger.error("Error getting dataset" + id)
602-
BadRequest(toJson(s"The given dataset id $id is not a valid ObjectId."))
602+
NotFound(toJson(s"The given dataset id $id is not a valid ObjectId."))
603603
}
604604
}
605605

@@ -639,7 +639,7 @@ class Datasets @Inject()(
639639
}
640640
case None => {
641641
Logger.error("Error getting dataset" + dsId)
642-
BadRequest(toJson(s"The given dataset id $dsId is not a valid ObjectId."))
642+
NotFound(toJson(s"The given dataset id $dsId is not a valid ObjectId."))
643643
}
644644
}
645645

@@ -661,7 +661,7 @@ class Datasets @Inject()(
661661
}
662662
case None => {
663663
Logger.error("Error getting dataset" + id)
664-
BadRequest(toJson(s"The given dataset id $id is not a valid ObjectId."))
664+
NotFound(toJson(s"The given dataset id $id is not a valid ObjectId."))
665665
}
666666
}
667667
}
@@ -717,13 +717,13 @@ class Datasets @Inject()(
717717
}
718718
case None => {
719719
Logger.error("Error getting file" + fileId)
720-
BadRequest(toJson(s"The given dataset id $dsId is not a valid ObjectId."))
720+
NotFound(toJson(s"The given dataset id $dsId is not a valid ObjectId."))
721721
}
722722
}
723723
}
724724
case None => {
725725
Logger.error("Error getting dataset" + dsId)
726-
BadRequest(toJson(s"The given dataset id $dsId is not a valid ObjectId."))
726+
NotFound(toJson(s"The given dataset id $dsId is not a valid ObjectId."))
727727
}
728728
}
729729
}
@@ -810,19 +810,19 @@ class Datasets @Inject()(
810810
}
811811
case None => {
812812
Logger.error ("Error getting file" + fileId)
813-
BadRequest (toJson (s"The given file id $fileId is not a valid ObjectId.") )
813+
NotFound(toJson (s"The given file id $fileId is not a valid ObjectId.") )
814814
}
815815
}
816816
}
817817
case None => {
818818
Logger.error ("Error getting dataset" + toDatasetId)
819-
BadRequest (toJson (s"The given dataset id $toDatasetId is not a valid ObjectId.") )
819+
NotFound(toJson (s"The given dataset id $toDatasetId is not a valid ObjectId.") )
820820
}
821821
}
822822
}
823823
case None => {
824824
Logger.error ("Error getting dataset" + datasetId)
825-
BadRequest (toJson (s"The given dataset id $datasetId is not a valid ObjectId.") )
825+
NotFound(toJson (s"The given dataset id $datasetId is not a valid ObjectId.") )
826826
}
827827
}
828828
}
@@ -870,7 +870,7 @@ class Datasets @Inject()(
870870
datasets.index(id)
871871
Ok(toJson(Map("status" -> "success")))
872872
}
873-
case None => Logger.error(s"Error getting dataset $id"); NotFound
873+
case None => Logger.error(s"Error getting dataset $id"); NotFound(toJson(s"Error getting dataset $id"))
874874
}
875875
}
876876

@@ -923,7 +923,7 @@ class Datasets @Inject()(
923923
}
924924
}
925925
}
926-
case None => Logger.error(s"Error getting dataset $id"); NotFound
926+
case None => Logger.error(s"Error getting dataset $id"); NotFound(toJson(s"Error getting dataset $id"))
927927
}
928928
}
929929

@@ -956,7 +956,7 @@ class Datasets @Inject()(
956956
}
957957
Ok(toJson(metadataDefinitions.toList.sortWith( _.json.\("label").asOpt[String].getOrElse("") < _.json.\("label").asOpt[String].getOrElse("") )))
958958
}
959-
case None => BadRequest(toJson("The requested dataset does not exist"))
959+
case None => NotFound(toJson("The requested dataset does not exist"))
960960
}
961961
}
962962

@@ -975,7 +975,7 @@ class Datasets @Inject()(
975975
}
976976
case None => {
977977
Logger.error("Error getting dataset " + id);
978-
BadRequest(toJson("Error getting dataset " + id))
978+
NotFound(toJson("Error getting dataset " + id))
979979
}
980980
}
981981
}
@@ -1000,7 +1000,7 @@ class Datasets @Inject()(
10001000
}
10011001
case None => {
10021002
Logger.error("Error getting dataset " + id)
1003-
BadRequest(toJson("Error getting dataset " + id))
1003+
NotFound(toJson("Error getting dataset " + id))
10041004
}
10051005
}
10061006
}
@@ -1053,7 +1053,7 @@ class Datasets @Inject()(
10531053
Ok(toJson(list))
10541054
}
10551055
}
1056-
case None => Logger.error("Error getting dataset" + id); InternalServerError
1056+
case None => Logger.error("Error getting dataset" + id); NotFound(toJson("Error getting dataset" + id))
10571057
}
10581058
}
10591059

@@ -1090,7 +1090,7 @@ class Datasets @Inject()(
10901090
}
10911091
Ok(toJson(list))
10921092
}
1093-
case None => Logger.error("Error getting dataset" + id); InternalServerError
1093+
case None => Logger.error("Error getting dataset" + id); NotFound(toJson("Error getting dataset" + id))
10941094
}
10951095
}
10961096

@@ -1105,7 +1105,7 @@ class Datasets @Inject()(
11051105
}
11061106
}
11071107
case None => {
1108-
BadRequest(s"Dataset with id=${dataset_id} does not exist")
1108+
NotFound(s"Dataset with id=${dataset_id} does not exist")
11091109
}
11101110
}
11111111
}
@@ -1121,7 +1121,7 @@ class Datasets @Inject()(
11211121
}
11221122
}
11231123
case None => {
1124-
BadRequest(s"Dataset with id=${dataset_id} does not exist")
1124+
NotFound(s"Dataset with id=${dataset_id} does not exist")
11251125
}
11261126
}
11271127
}
@@ -1837,16 +1837,19 @@ class Datasets @Inject()(
18371837
case Some(dataset) => {
18381838
events.addSourceEvent(request.user, comment.id, comment.text , dataset.id, dataset.name, EventType.ADD_COMMENT_DATASET.toString)
18391839
}
1840+
case None => {
1841+
NotFound(s"The given id $id is not a valid ObjectId.")
1842+
}
18401843
}
18411844
Ok(comment.id.toString())
18421845
}
18431846
case None => {
18441847
Logger.error("no text specified.")
1845-
BadRequest
1848+
BadRequest("no text specified.")
18461849
}
18471850
}
18481851
}
1849-
case None => BadRequest
1852+
case None => NotFound(toJson("User not found!"))
18501853
}
18511854
}
18521855

@@ -1916,7 +1919,7 @@ class Datasets @Inject()(
19161919
Ok(toJson(Map("isBeingProcessed" -> isActivity)))
19171920
}
19181921
case None => {
1919-
Logger.error(s"Error getting dataset $id"); InternalServerError
1922+
Logger.error(s"Error getting dataset $id"); NotFound(toJson(s"Error getting dataset $id"))
19201923
}
19211924
}
19221925
}
@@ -1977,7 +1980,7 @@ class Datasets @Inject()(
19771980
Ok(jsonPreviewsFiles(previewslist.asInstanceOf[List[(models.File, List[(java.lang.String, String, String, String, java.lang.String, String, Long)])]]))
19781981
}
19791982
case None => {
1980-
Logger.error("Error getting dataset" + id); InternalServerError
1983+
Logger.error("Error getting dataset" + id); NotFound(toJson("Error getting dataset\" + id"))
19811984
}
19821985
}
19831986
}
@@ -2051,7 +2054,7 @@ class Datasets @Inject()(
20512054
Ok(toJson(Map("status"->"success")))
20522055
}
20532056
}
2054-
case None => BadRequest("No dataset found with id " + id)
2057+
case None => NotFound("No dataset found with id " + id)
20552058
}
20562059
}
20572060

@@ -2066,10 +2069,10 @@ class Datasets @Inject()(
20662069

20672070
Ok(toJson(Map("status" -> "success")))
20682071
}
2069-
case None => InternalServerError("Update Access failed")
2072+
case None => NotFound(s"Update Access failed. Dataset id $id not found.")
20702073
}
20712074
}
2072-
case None => BadRequest("No user supplied")
2075+
case None => NotFound("User not found")
20732076
}
20742077
}
20752078

@@ -2095,7 +2098,7 @@ class Datasets @Inject()(
20952098
val trashDatasets = datasets.listUserTrash(user,limit)
20962099
Ok(toJson(trashDatasets))
20972100
}
2098-
case None => BadRequest("No user supplied")
2101+
case None => NotFound("User not found")
20992102
}
21002103
}
21012104

@@ -2124,7 +2127,7 @@ class Datasets @Inject()(
21242127
.withHeaders(CONTENT_TYPE -> "application/rdf+xml")
21252128
.withHeaders(CONTENT_DISPOSITION -> (FileUtils.encodeAttachment(resultFile.getName(),request.headers.get("user-agent").getOrElse(""))))
21262129
}
2127-
case None => BadRequest(toJson("Dataset not found " + id))
2130+
case None => NotFound(toJson("Dataset not found " + id))
21282131
}
21292132
}
21302133
case _ => Ok("RDF export plugin not enabled")
@@ -2165,7 +2168,7 @@ class Datasets @Inject()(
21652168
case Some(listJson) => {
21662169
Ok(listJson)
21672170
}
2168-
case None => Logger.error(s"Error getting dataset $id"); InternalServerError
2171+
case None => Logger.error(s"Error getting dataset $id");NotFound(s"Error getting dataset $id")
21692172
}
21702173
}
21712174
case false => {
@@ -2182,7 +2185,7 @@ class Datasets @Inject()(
21822185
.map(JSONLD.jsonMetadataWithContext(_) \ "content")
21832186
Ok(toJson(listOfMetadata))
21842187
}
2185-
case None => Logger.error("Error finding dataset" + id); InternalServerError
2188+
case None => Logger.error("Error finding dataset" + id); NotFound("Error finding dataset" + id)
21862189
}
21872190
}
21882191

@@ -2191,7 +2194,7 @@ class Datasets @Inject()(
21912194
case Some(dataset) => {
21922195
Ok(datasets.getXMLMetadataJSON(id))
21932196
}
2194-
case None => {Logger.error("Error finding dataset" + id); InternalServerError}
2197+
case None => {Logger.error("Error finding dataset" + id); NotFound("Error finding dataset" + id)}
21952198
}
21962199
}
21972200

@@ -2201,8 +2204,7 @@ class Datasets @Inject()(
22012204
Ok(datasets.getUserMetadataJSON(id))
22022205
}
22032206
case None => {
2204-
Logger.error("Error finding dataset" + id);
2205-
InternalServerError
2207+
Logger.error("Error finding dataset" + id);NotFound("Error finding dataset" + id)
22062208
}
22072209

22082210
}
@@ -2983,13 +2985,13 @@ class Datasets @Inject()(
29832985
case None => BadRequest(s"Unable to copy the dataset with id $datasetId to space with id: $spaceId")
29842986
}
29852987
}
2986-
case None => BadRequest(s"No space found with id: + $spaceId.")
2988+
case None => NotFound(s"No space found with id: + $spaceId.")
29872989
}
29882990
} else {
29892991
BadRequest("You don't have permission to copy the dataset.")
29902992
}
29912993
}
2992-
case None => BadRequest(s"No dataset found with id: $datasetId")
2994+
case None => NotFound(s"No dataset found with id: $datasetId")
29932995
}
29942996
}
29952997
case None => BadRequest("You need to be logged in to copy a dataset to a space.")
@@ -3126,7 +3128,7 @@ class Datasets @Inject()(
31263128
}
31273129
case None => {
31283130
Logger.error("Error getting dataset " + id)
3129-
NotFound
3131+
NotFound("Error getting dataset " + id)
31303132
}
31313133
}
31323134
}
@@ -3149,7 +3151,7 @@ class Datasets @Inject()(
31493151
}
31503152
case None => {
31513153
Logger.error("Error getting dataset " + id)
3152-
NotFound
3154+
NotFound("Error getting dataset " + id)
31533155
}
31543156
}
31553157
}

0 commit comments

Comments
 (0)