Skip to content

Commit aeca855

Browse files
committed
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 ba85b03 commit aeca855

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
@@ -93,9 +93,16 @@ export const action = new FileAction({
9393
return new Array(nodes.length).fill(null)
9494
}
9595

96+
const rawDir = nodes[0].dirname ?? nodes[0].path.substring(0, nodes[0].path.lastIndexOf('/'))
97+
const normalizedDir = (rawDir && rawDir !== '/') ? rawDir.replace(/\/+$/, '') : ''
98+
const envelopePath = normalizedDir ? `${normalizedDir}/${envelopeName}` : `/${envelopeName}`
99+
96100
return axios.post(generateOcsUrl('/apps/libresign/api/v1/file'), {
97101
files: nodes.map(node => ({ fileId: node.fileid })),
98102
name: envelopeName,
103+
settings: {
104+
path: envelopePath,
105+
},
99106
}).then((response) => {
100107
const envelopeData = response.data?.ocs?.data
101108

0 commit comments

Comments
 (0)