Skip to content

Commit 3eec9af

Browse files
feat: add envelope path configuration in batch file action
When creating envelopes from multiple files, the envelope path is now properly configured based on the parent directory of the selected files. This ensures envelopes are created in the same directory as the source files instead of the root folder. The path is normalized to handle edge cases like root directory and trailing slashes, providing consistent behavior across different file locations. Signed-off-by: Vitor Mattos <[email protected]>
1 parent e09cb34 commit 3eec9af

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/actions/openInLibreSignAction.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,16 @@ export const action = new FileAction({
7979
return new Array(nodes.length).fill(null)
8080
}
8181

82+
const rawDir = nodes[0].dirname ?? nodes[0].path.substring(0, nodes[0].path.lastIndexOf('/'))
83+
const normalizedDir = (rawDir && rawDir !== '/') ? rawDir.replace(/\/+$/, '') : ''
84+
const envelopePath = normalizedDir ? `${normalizedDir}/${envelopeName}` : `/${envelopeName}`
85+
8286
return axios.post(generateOcsUrl('/apps/libresign/api/v1/file'), {
8387
files: nodes.map(node => ({ fileId: node.fileid })),
8488
name: envelopeName,
89+
settings: {
90+
path: envelopePath,
91+
},
8592
}).then((response) => {
8693
const envelopeData = response.data?.ocs?.data
8794

0 commit comments

Comments
 (0)