|
@@ -41,10 +41,11 @@ export type IDataGROWIInfo = {
|
|
|
fileUploadDisabled: boolean;
|
|
fileUploadDisabled: boolean;
|
|
|
fileUploadTotalLimit: number | null // Handle null as Infinity
|
|
fileUploadTotalLimit: number | null // Handle null as Infinity
|
|
|
attachmentInfo: {
|
|
attachmentInfo: {
|
|
|
- type: string,
|
|
|
|
|
- bucket?: string,
|
|
|
|
|
- customEndpoint?: string, // for S3
|
|
|
|
|
- uploadNamespace?: string, // for GCS
|
|
|
|
|
|
|
+ type: string;
|
|
|
|
|
+ writable: boolean;
|
|
|
|
|
+ bucket?: string;
|
|
|
|
|
+ customEndpoint?: string; // for S3
|
|
|
|
|
+ uploadNamespace?: string; // for GCS
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -149,18 +150,14 @@ export class G2GTransferPusherService implements Pusher {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public async askGROWIInfo(tk: TransferKey): Promise<IDataGROWIInfo> {
|
|
public async askGROWIInfo(tk: TransferKey): Promise<IDataGROWIInfo> {
|
|
|
- // axios get
|
|
|
|
|
- let toGROWIInfo: IDataGROWIInfo;
|
|
|
|
|
try {
|
|
try {
|
|
|
- const res = await axios.get('/_api/v3/g2g-transfer/growi-info', generateAxiosRequestConfigWithTransferKey(tk));
|
|
|
|
|
- toGROWIInfo = res.data.growiInfo;
|
|
|
|
|
|
|
+ const { data: { growiInfo } } = await axios.get('/_api/v3/g2g-transfer/growi-info', generateAxiosRequestConfigWithTransferKey(tk));
|
|
|
|
|
+ return growiInfo;
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
logger.error(err);
|
|
logger.error(err);
|
|
|
throw new G2GTransferError('Failed to retrieve growi info.', G2GTransferErrorCode.FAILED_TO_RETRIEVE_GROWI_INFO);
|
|
throw new G2GTransferError('Failed to retrieve growi info.', G2GTransferErrorCode.FAILED_TO_RETRIEVE_GROWI_INFO);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return toGROWIInfo;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -197,6 +194,14 @@ export class G2GTransferPusherService implements Pusher {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (!toGROWIInfo.attachmentInfo.writable) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ canTransfer: false,
|
|
|
|
|
+ // TODO: i18n for reason
|
|
|
|
|
+ reason: 'The storage of new Growi is not writable.',
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const totalFileSize = await fileUploadService.getTotalFileSize();
|
|
const totalFileSize = await fileUploadService.getTotalFileSize();
|
|
|
if ((toGROWIInfo.fileUploadTotalLimit ?? Infinity) < totalFileSize) {
|
|
if ((toGROWIInfo.fileUploadTotalLimit ?? Infinity) < totalFileSize) {
|
|
|
return {
|
|
return {
|
|
@@ -445,10 +450,10 @@ export class G2GTransferReceiverService implements Receiver {
|
|
|
|
|
|
|
|
const attachmentInfo = {
|
|
const attachmentInfo = {
|
|
|
type: configManager.getConfig('crowi', 'app:fileUploadType'),
|
|
type: configManager.getConfig('crowi', 'app:fileUploadType'),
|
|
|
|
|
+ writable: isWritable,
|
|
|
bucket: undefined,
|
|
bucket: undefined,
|
|
|
customEndpoint: undefined, // for S3
|
|
customEndpoint: undefined, // for S3
|
|
|
uploadNamespace: undefined, // for GCS
|
|
uploadNamespace: undefined, // for GCS
|
|
|
- writable: isWritable,
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// put storage location info to check storage identification
|
|
// put storage location info to check storage identification
|