-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[PS 1885] Fixing error when exporting an organization vault #4367
Conversation
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.
@cyprain-okeke Changes are looking good and address the issue with the broken export.
Just some minor improvements.
Please also speak with @r-tome as this was introduced with (EC-584) and passed QA.
@@ -9,12 +9,12 @@ export class OrganizationExportResponse extends BaseResponse { | |||
constructor(response: any) { | |||
super(response); | |||
const collections = this.getResponseProperty("Collections"); | |||
if (collections != null) { | |||
this.collections = collections.map((c: any) => new CollectionResponse(c)); |
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.
Could we add a type here? I think we are still trying to receive a ListResponse<T>
(ListResponse<CollectionResponse>
?) from this.getResponseProperty("Collections")
This would have shown the type error during development.
} | ||
const ciphers = this.getResponseProperty("Ciphers"); | ||
if (ciphers != null) { | ||
this.ciphers = ciphers.map((c: any) => new CipherResponse(c)); |
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.
See comment above.
@@ -9,12 +9,12 @@ export class OrganizationExportResponse extends BaseResponse { | |||
constructor(response: any) { | |||
super(response); | |||
const collections = this.getResponseProperty("Collections"); | |||
if (collections != null) { | |||
this.collections = collections.map((c: any) => new CollectionResponse(c)); | |||
if (collections.data != null) { |
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.
The null checks should check both objects (collections and collections.data)
This issue has already been fixed. Client versions from 2022.09 until 2022.12 expect an object with Now server checks for the client version and responds with what the client expects (ListResponse or an array) https://github.com/bitwarden/server/blob/master/src/Api/Controllers/OrganizationExportController.cs#L44 QA tested both client versions hence why it passed the tests. |
I have tested the fix on version 2023.1 and it works very well. |
Type of change
Objective
Fixing an error is displayed when exporting an organization vault
Code changes
Screenshots
Before you submit