Skip to content

Commit 7319884

Browse files
committed
Revert to full config
1 parent 587fccf commit 7319884

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

spec/CloudCode.spec.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,18 +3698,16 @@ describe('saveFile hooks', () => {
36983698
// Get the actual config values that will be used
36993699
const config = Config.get('test');
37003700

3701-
const expectedConfig = {
3702-
applicationId: config.applicationId,
3703-
mount: config.mount,
3704-
fileKey: config.fileKey
3705-
};
3701+
if (!config.mount){
3702+
config.mount = 'http://localhost:8378/1'; // Default mount for tests
3703+
}
37063704

37073705
expect(createFileSpy).toHaveBeenCalledWith(
37083706
jasmine.any(String),
37093707
newData,
37103708
'text/plain',
37113709
newOptions,
3712-
expectedConfig
3710+
config
37133711
);
37143712
});
37153713

@@ -3739,18 +3737,16 @@ describe('saveFile hooks', () => {
37393737
};
37403738
const config = Config.get('test');
37413739

3742-
const expectedConfig = {
3743-
applicationId: config.applicationId,
3744-
mount: config.mount,
3745-
fileKey: config.fileKey
3746-
};
3740+
if (!config.mount){
3741+
config.mount = 'http://localhost:8378/1'; // Default mount for tests
3742+
}
37473743

37483744
expect(createFileSpy).toHaveBeenCalledWith(
37493745
jasmine.any(String),
37503746
newData,
37513747
newContentType,
37523748
newOptions,
3753-
expectedConfig
3749+
config
37543750
);
37553751
const expectedFileName = 'donald_duck.pdf';
37563752
expect(file._name.indexOf(expectedFileName)).toBe(file._name.length - expectedFileName.length);
@@ -3778,18 +3774,16 @@ describe('saveFile hooks', () => {
37783774
};
37793775
const config = Config.get('test');
37803776

3781-
const expectedConfig = {
3782-
applicationId: config.applicationId,
3783-
mount: config.mount,
3784-
fileKey: config.fileKey
3785-
};
3777+
if (!config.mount){
3778+
config.mount = 'http://localhost:8378/1'; // Default mount for tests
3779+
}
37863780

37873781
expect(createFileSpy).toHaveBeenCalledWith(
37883782
jasmine.any(String),
37893783
jasmine.any(Buffer),
37903784
'text/plain',
37913785
options,
3792-
expectedConfig
3786+
config
37933787
);
37943788
});
37953789

src/Controllers/FilesController.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,11 @@ export class FilesController extends AdaptableController {
2929
filename = randomHexString(32) + '_' + filename;
3030
}
3131

32-
// Create a clean config object with only the properties needed by file adapters
33-
const basicServerConfig = {
34-
applicationId: config.applicationId,
35-
mount: config.mount,
36-
fileKey: config.fileKey
37-
};
38-
39-
const createResult = await this.adapter.createFile(filename, data, contentType, options, basicServerConfig);
32+
33+
const createResult = await this.adapter.createFile(filename, data, contentType, options, config);
4034
filename = createResult?.name || filename; // if createFile returns a new filename, use it
4135

42-
const url = createResult?.url || await this.adapter.getFileLocation(basicServerConfig, filename); // if createFile returns a new url, use it otherwise get the url from the adapter
36+
const url = createResult?.url || await this.adapter.getFileLocation(config, filename); // if createFile returns a new url, use it otherwise get the url from the adapter
4337

4438
return {
4539
url: url,

0 commit comments

Comments
 (0)