-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add file.isPublic() function #708
Conversation
Codecov Report
@@ Coverage Diff @@
## master #708 +/- ##
==========================================
+ Coverage 96.77% 96.79% +0.01%
==========================================
Files 9 9
Lines 1149 1155 +6
Branches 294 295 +1
==========================================
+ Hits 1112 1118 +6
Misses 9 9
Partials 28 28
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gaxios
is not in package.json
explicitly. If we're using gaxios
to make requests, then we should add it to package.json
under dependencies
Done, thank you |
src/file.ts
Outdated
isPublic(callback?: IsPublicCallback): Promise<IsPublicResponse> | void { | ||
gaxiosRequest({ | ||
method: 'HEAD', | ||
url: `http://${this.bucket.name}.storage.googleapis.com/${this.id}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to encode the name:
url: `http://${this.bucket.name}.storage.googleapis.com/${encodeURIComponent(this.name)}`,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done
It only matters in the case where file.name
property is changed on an already existing file
object, which would render all other file properties' values incorrect in respect to the new file.name
.
Shouldn't the file.name
property be made readonly
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only matters in the case where file.name property is changed
Do you mean the name
property is already encoded? I didn't see that in the code.
Shouldn't the file.name property be made readonly?
I suppose. name
wasn't intended to be a public property at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't think of this sooner.
src/file.ts
Outdated
* @property {boolean} 0 Whether file is public or not. | ||
*/ | ||
/** | ||
* Check whether this file is public or not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should explain how we are doing this. It is possible the server has a hiccup and returns an error code, even though the file is public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AVaksman for putting this together. Apologies for the delay in my review, LGTM.
Thanks. |
Fixes #683