Skip to content

Commit 9aeafa8

Browse files
remove filelink method and direct delete keys from params
1 parent 48e9d91 commit 9aeafa8

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

src/lib/api/store.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ export const storeURL = ({
6868
session.signature = security && security.signature || session.signature;
6969

7070
const filelink = new Filelink(url, session.apikey);
71+
72+
if (url && typeof storeParams === 'object' && storeParams !== null){
73+
if (storeParams['mimetype']) {
74+
delete storeParams['mimetype'];
75+
}
76+
if (storeParams['altText']) {
77+
delete storeParams['altText'];
78+
}
79+
}
80+
7181
filelink.store(storeParams);
7282

7383
if (session.policy && session.signature) {
@@ -93,11 +103,6 @@ export const storeURL = ({
93103
headers,
94104
}];
95105
}
96-
97-
if (sources && sources?.length > 0) {
98-
filelink.removeTaskParams('store', ['mimetype','altText']);
99-
}
100-
101106
if (workflowIds && workflowIds.length > 0) {
102107
filelink.addTask('store', { workflows: workflowIds });
103108
}

src/lib/filelink.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -781,42 +781,6 @@ export class Filelink {
781781
return this;
782782
}
783783

784-
/**
785-
* Remove specific parameter keys from tasks
786-
*
787-
* @param {string} taskName - Name of the task to target
788-
* @param {string|string[]} paramKeys - Parameter key(s) to remove
789-
* @returns {Filelink} - Returns this for chaining
790-
* @memberof Filelink
791-
*/
792-
removeTaskParams(taskName, paramKeys) {
793-
Debug(`Remove params ${paramKeys} from task ${taskName}`);
794-
795-
const keysToRemove = Array.isArray(paramKeys) ? paramKeys : [paramKeys];
796-
const validKeys = keysToRemove.filter(key => key && typeof key === 'string');
797-
798-
if (validKeys.length === 0) {
799-
Debug('No valid parameter keys to remove');
800-
return this;
801-
}
802-
803-
this.transforms.forEach(task => {
804-
if (task.name === taskName && task.params && typeof task.params === 'object' && !Array.isArray(task.params)) {
805-
let hasChanges = false;
806-
validKeys.forEach(key => {
807-
if (key in task.params) {
808-
delete task.params[key];
809-
hasChanges = true;
810-
}
811-
});
812-
if (hasChanges && Object.keys(task.params).length === 0) {
813-
task.params = undefined;
814-
}
815-
}
816-
});
817-
return this;
818-
}
819-
820784
/**
821785
* Returns all tasks added for transformation
822786
*

0 commit comments

Comments
 (0)