Skip to content

Commit

Permalink
Fix the issue of file synchronization in live space when an incorrect…
Browse files Browse the repository at this point in the history
… URL is configured
  • Loading branch information
hexiaofeng committed Jun 3, 2024
1 parent 80ee4b8 commit a38a7d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.jd.live.agent.core.parser.ObjectParser;
import com.jd.live.agent.core.service.file.FileContent;
import com.jd.live.agent.core.service.file.FileDigest;
import com.jd.live.agent.core.util.Futures;

import java.io.*;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -56,7 +57,10 @@ public abstract class AbstractFileSyncer<T> extends AbstractSyncer<T, FileDigest
protected CompletableFuture<Void> doStart() {
config = getSyncConfig();
file = getConfigFile();
if (file != null && publisher != null) {
if (file == null) {
return Futures.future(new FileNotFoundException("File is not found. " + getResource(config)));
}
if (publisher != null) {
publisher.addHandler(handler);
}
return super.doStart();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ protected SyncConfig getSyncConfig() {
@Override
protected String getResource(SyncConfig config) {
String result = super.getResource(config);
return result == null || result.isEmpty() ? CONFIG_LIVE_SPACE : result;
if (result == null || result.isEmpty()) {
return CONFIG_LIVE_SPACE;
} else if (result.startsWith("http://") || result.startsWith("https://")) {
return CONFIG_LIVE_SPACE;
}
return result;
}

@Override
Expand Down

0 comments on commit a38a7d6

Please sign in to comment.