Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
for passing in credentials to the S3ByteStorageService.

### Fixed
- Upgraded extractor parameters jsonform to version `2.2.5`.
- Cleaning up after a failed upload should no longer decrement the file + byte counts.
- Fix the broken link after file deletion within a folder. [#277](https://github.com/clowder-framework/clowder/issues/277)

### Changed
- now building mongo-init and monitor docker containers with python 3.8
Expand Down
18 changes: 18 additions & 0 deletions app/api/Folders.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import scala.collection.mutable.ListBuffer
class Folders @Inject() (
folders: FolderService,
datasets: DatasetService,
collections: CollectionService,
files: FileService,
events: EventService,
routing: ExtractorRoutingService) extends ApiController {
Expand Down Expand Up @@ -316,6 +317,23 @@ class Folders @Inject() (
if(dataset.files.contains(fileId)) {
folders.addFile(newFolder.id, fileId)
datasets.removeFile(datasetId, fileId)

// when moving a file in the root of a dataset inside a folder
// check if that file has been used as thumbnail
// if yes, update the thumbnail of both dataset and collection
if(!file.thumbnail_id.isEmpty && !dataset.thumbnail_id.isEmpty){
if (file.thumbnail_id.get.equals(dataset.thumbnail_id.get)){
datasets.newThumbnail(dataset.id)
collections.get(dataset.collections).found.foreach(collection => {
if(!collection.thumbnail_id.isEmpty){
if(collection.thumbnail_id.get.equals(dataset.thumbnail_id.get)){
collections.createThumbnail(collection.id)
}
}
})
}
}

files.index(fileId)
datasets.index(datasetId)
Ok(toJson(Map("status" -> "success", "fileName" -> file.filename, "folderName" -> newFolder.name)))
Expand Down