Skip to content

Commit

Permalink
Merge pull request #23 from hapinessjs/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
juneil committed Aug 27, 2019
2 parents a90314b + 6124f56 commit 628f52f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@hapiness/mingo",
"version": "2.1.1",
"version": "2.1.2",
"description": "Manage files using minio as file storage and mongodb for metadata",
"main": "commonjs/index.js",
"types": "index.d.ts",
Expand Down
12 changes: 11 additions & 1 deletion src/module/managers/files.manager.ts
Expand Up @@ -137,7 +137,17 @@ export class FilesManager {
filename: string, projection?: string | string[], options?: { [key: string]: any }
): Observable<MingoFileInterface> {
const projectionStr = projection && projection instanceof Array ? projection.join(' ') : projection as string;
return this.fileRepository.findFileByFilename(filename, this.bucketService.getName(), projectionStr, options);
return Observable.of(filename)
.flatMap(fname => !!fname
? this.fileRepository
.findFileByFilename(
filename,
this.bucketService.getName(),
projectionStr,
options
)
: Observable.throw(Biim.badRequest(`No filename provided`))
);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions test/functional/mingo.module.test.ts
Expand Up @@ -60,6 +60,8 @@ export class MingoModuleFunctionalTest {

fb().create(fs.createReadStream('./package.json'), 'package.json', 'application/json', null)
.do(_ => Object.assign(fileProperties, { id: _.id, created_at: _.created_at, updated_at: _.updated_at }))
// dunno why but etag given by stat function is no more a md5 ?!
.do(_ => fileProperties.md5 = _.md5)
.do(_ => unit
.object(_)
.is(fileProperties)
Expand Down

0 comments on commit 628f52f

Please sign in to comment.