fix: skin upload: error message from server is not displayed

This commit is contained in:
Haowei Wen
2021-02-17 22:47:17 +08:00
committed by Yuhui Huang
parent 454cc1e702
commit ac1f2ec1ed

View File

@@ -28,7 +28,6 @@ import org.jackhuang.hmcl.util.gson.UUIDTypeAdapter;
import org.jackhuang.hmcl.util.gson.ValidationTypeAdapterFactory; import org.jackhuang.hmcl.util.gson.ValidationTypeAdapterFactory;
import org.jackhuang.hmcl.util.io.FileUtils; import org.jackhuang.hmcl.util.io.FileUtils;
import org.jackhuang.hmcl.util.io.HttpMultipartRequest; import org.jackhuang.hmcl.util.io.HttpMultipartRequest;
import org.jackhuang.hmcl.util.io.IOUtils;
import org.jackhuang.hmcl.util.io.NetworkUtils; import org.jackhuang.hmcl.util.io.NetworkUtils;
import org.jackhuang.hmcl.util.javafx.ObservableOptionalCache; import org.jackhuang.hmcl.util.javafx.ObservableOptionalCache;
@@ -164,10 +163,7 @@ public class YggdrasilService {
request.file("file", FileUtils.getName(file), "image/" + FileUtils.getExtension(file), fis); request.file("file", FileUtils.getName(file), "image/" + FileUtils.getExtension(file), fis);
} }
} }
String response = IOUtils.readFullyAsString(con.getInputStream()); requireEmpty(NetworkUtils.readData(con));
if (response.startsWith("{")) {
handleErrorMessage(fromJson(response, ErrorResponse.class));
}
} catch (IOException e) { } catch (IOException e) {
throw new AuthenticationException(e); throw new AuthenticationException(e);
} }