diff --git a/core/src/main/java/hudson/model/DownloadService.java b/core/src/main/java/hudson/model/DownloadService.java index 0ea2f25cd762e660d7338ba3f8f58d82f87be8c6..0e918e1424b470c50f02f876881864535655d82b 100644 --- a/core/src/main/java/hudson/model/DownloadService.java +++ b/core/src/main/java/hudson/model/DownloadService.java @@ -39,6 +39,7 @@ import java.util.logging.Logger; import net.sf.json.JSONObject; import org.kohsuke.stapler.StaplerRequest; +import org.kohsuke.stapler.StaplerResponse; /** * Service for plugins to periodically retrieve update data files @@ -200,13 +201,14 @@ public class DownloadService extends PageDecorator { /** * This is where the browser sends us the data. */ - public void doPostBack(StaplerRequest req) throws IOException { + public void doPostBack(StaplerRequest req, StaplerResponse rsp) throws IOException { long dataTimestamp = System.currentTimeMillis(); TextFile df = getDataFile(); df.write(IOUtils.toString(req.getInputStream(),"UTF-8")); df.file.setLastModified(dataTimestamp); due = dataTimestamp+getInterval(); LOGGER.info("Obtained the updated data file for "+id); + rsp.setContentType("text/plain"); // So browser won't try to parse response } /** diff --git a/core/src/main/java/hudson/model/UpdateSite.java b/core/src/main/java/hudson/model/UpdateSite.java index fd4c08e00b57a424609ffd1e6b456a4cee678698..863a5f2bb6994ef2c6fa146dc66cb177f0f814fc 100644 --- a/core/src/main/java/hudson/model/UpdateSite.java +++ b/core/src/main/java/hudson/model/UpdateSite.java @@ -134,7 +134,7 @@ public class UpdateSite { /** * This is the endpoint that receives the update center data file from the browser. */ - public void doPostBack(StaplerRequest req) throws IOException, GeneralSecurityException { + public void doPostBack(StaplerRequest req, StaplerResponse rsp) throws IOException, GeneralSecurityException { dataTimestamp = System.currentTimeMillis(); String json = IOUtils.toString(req.getInputStream(),"UTF-8"); JSONObject o = JSONObject.fromObject(json); @@ -150,6 +150,7 @@ public class UpdateSite { LOGGER.info("Obtained the latest update center data file for UpdateSource "+ id); getDataFile().write(json); + rsp.setContentType("text/plain"); // So browser won't try to parse response } /**