fix: 修复同步、复制 excel 数据源失败

This commit is contained in:
taojinlong
2025-03-10 18:52:04 +08:00
committed by taojinlong
parent 34f586467d
commit 69a97e824f
3 changed files with 8 additions and 4 deletions

View File

@@ -423,7 +423,7 @@ public class ExcelUtils {
if (remoteExcelRequest.getUrl().trim().startsWith("http")) {
HttpClientConfig httpClientConfig = new HttpClientConfig();
if (StringUtils.isNotEmpty(remoteExcelRequest.getUserName()) && StringUtils.isNotEmpty(remoteExcelRequest.getPasswd())) {
String authValue = "Basic " + Base64.getUrlEncoder().encodeToString((new String(Base64.getDecoder().decode(remoteExcelRequest.getUserName())) + ":" + new String(Base64.getDecoder().decode(remoteExcelRequest.getPasswd()))).getBytes());
String authValue = "Basic " + Base64.getUrlEncoder().encodeToString((remoteExcelRequest.getUserName() + ":" + remoteExcelRequest.getPasswd()).getBytes());
httpClientConfig.addHeader("Authorization", authValue);
}
File p = new File(path);
@@ -756,8 +756,8 @@ public class ExcelUtils {
}
}
if (StringUtils.isNotEmpty(remoteExcelRequest.getUserName()) && StringUtils.isNotEmpty(remoteExcelRequest.getPasswd())) {
username = new String(Base64.getDecoder().decode(remoteExcelRequest.getUserName()));
password = new String(Base64.getDecoder().decode(remoteExcelRequest.getPasswd()));
username = remoteExcelRequest.getUserName();
password = remoteExcelRequest.getPasswd();
}
filePath = filePath.startsWith("/") ? filePath.substring(1) : filePath;
int port = 21;

View File

@@ -889,6 +889,8 @@ public class DatasourceServer implements DatasourceApi {
}
public ExcelFileData loadRemoteFile(RemoteExcelRequest remoteExcelRequest) throws DEException, IOException {
remoteExcelRequest.setUserName(new String(Base64.getDecoder().decode(remoteExcelRequest.getUserName())));
remoteExcelRequest.setPasswd(new String(Base64.getDecoder().decode(remoteExcelRequest.getPasswd())));
ExcelFileData excelFileData = new ExcelUtils().parseRemoteExcel(remoteExcelRequest);
CoreDatasource coreDatasource = null;
if (ObjectUtils.isNotEmpty(remoteExcelRequest.getDatasourceId()) && 0L != remoteExcelRequest.getDatasourceId()) {

View File

@@ -504,7 +504,7 @@ const saveDS = () => {
const validateApi = excelRemote?.value?.submitSyncSettingForm()
validateApi(v => {
if (v) {
if (editDs.value) {
if (editDs.value && form2.id) {
complete(null, null, null)
} else {
creatDsFolder.value.createInit('datasource', { id: pid.value }, '', form2.name)
@@ -691,6 +691,8 @@ const init = (nodeInfo: Form | Param, id?: string, res?: object, supportSetKey:
Object.assign(form, cloneDeep(defaultForm))
pid.value = id || '0'
}
console.log(nodeInfo)
console.log(pid.value)
activeStep.value = Number(editDs.value)
activeApiStep.value = activeStep.value