Skip to content

Commit

Permalink
[FIX] dms: Set the correct directory_id value according to the domain…
Browse files Browse the repository at this point in the history
… to Upload button

Example use case:

- Go to Documents > Files menu.
- Select a directory in search_panel (or from the Files smart-button of a directory).
- Click on the "Upload" button
- The file has been successfully added to the directory
  • Loading branch information
victoralmau committed Feb 9, 2024
1 parent dbcc877 commit d849c22
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions dms/static/src/js/views/dms_file_upload.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,16 @@ export const FileUpload = {
return;
}

if (this.props.domain.length === 1) {
ctx.default_directory_id = this.props.domain[0][2];
} else {
ctx.default_directory_id = this.props.domain[2][2];
// Search the correct directory_id value according to the domain
ctx.default_directory_id = false;
if (this.props.domain) {
for (const domain_item of this.props.domain) {
if (domain_item.length === 3) {
if (domain_item[0] === "directory_id" && domain_item[1] === "=") {
ctx.default_directory_id = domain_item[2];
}
}
}
}

if (ctx.default_directory_id === false) {
Expand Down

0 comments on commit d849c22

Please sign in to comment.