Skip to content

Commit 7401906

Browse files
authored
fix: Fix compatibility issue with some OneDrive addition failures (#11748)
Refs #11741 #11685
1 parent 5aa3c29 commit 7401906

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

agent/app/service/backup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ func loadRefreshTokenByCode(backup *model.BackupAccount) (string, error) {
535535
if err := json.Unmarshal([]byte(backup.Vars), &varMap); err != nil {
536536
return "", fmt.Errorf("unmarshal backup vars failed, err: %v", err)
537537
}
538-
if _, ok := varMap["refresh_token"]; ok {
538+
if token, ok := varMap["refresh_token"]; ok && len(token.(string)) != 0 {
539539
return "", nil
540540
}
541541
refreshToken := ""

frontend/src/views/setting/backup-account/operate/index.vue

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@
347347
>
348348
<el-input v-model.trim="dialogData.rowData!.varsJson['redirect_uri']" />
349349
</el-form-item>
350-
<el-form-item :label="$t('setting.code')" prop="varsJson.code" :rules="rules.driveCode">
350+
<el-form-item :label="$t('setting.code')" prop="varsJson.code">
351351
<div class="!w-full">
352352
<el-input
353353
style="width: calc(100% - 80px)"
@@ -430,19 +430,6 @@ const regionInput = ref();
430430
431431
const domainProto = ref('http');
432432
const emit = defineEmits(['search']);
433-
const rules = reactive({
434-
driveCode: [{ validator: checkDriveCode, required: true, trigger: 'blur' }],
435-
});
436-
function checkDriveCode(rule: any, value: any, callback: any) {
437-
if (!value) {
438-
return callback(new Error(i18n.global.t('setting.codeWarning')));
439-
}
440-
const reg = /^[A-Za-z0-9/_.-]+$/;
441-
if (!reg.test(value)) {
442-
return callback(new Error(i18n.global.t('setting.codeWarning')));
443-
}
444-
callback();
445-
}
446433
447434
interface DialogProps {
448435
title: string;
@@ -726,6 +713,11 @@ const onCheck = async (formEl: FormInstance | undefined) => {
726713
dialogData.value.rowData!.varsJson['endpoint'] = itemEndpoint;
727714
}
728715
}
716+
if (isOneDrive()) {
717+
dialogData.value.rowData!.varsJson['code'] = decodeURIComponent(
718+
dialogData.value.rowData!.varsJson['code'] || '',
719+
);
720+
}
729721
if (isALIYUNYUN()) {
730722
dialogData.value.rowData!.varsJson['token'] = undefined;
731723
}

0 commit comments

Comments
 (0)