Set content type to 'text/html' when publishing to Google Drive using HTML or template output

This commit is contained in:
benweet 2013-09-21 13:04:50 +01:00
parent 100ccd4f5d
commit d172aaad1b
2 changed files with 7 additions and 6 deletions

View File

@ -99,7 +99,7 @@ define([
task.enqueue();
};
googleHelper.upload = function(fileId, parentId, title, content, etag, callback) {
googleHelper.upload = function(fileId, parentId, title, content, contentType, etag, callback) {
var result = undefined;
var task = new AsyncTask();
connect(task);
@ -108,7 +108,7 @@ define([
var boundary = '-------314159265358979323846';
var delimiter = "\r\n--" + boundary + "\r\n";
var close_delim = "\r\n--" + boundary + "--";
var contentType = 'text/x-markdown';
contentType = contentType || 'text/x-markdown';
var metadata = {
title: title,
mimeType: contentType

View File

@ -92,7 +92,7 @@ define([
}
}
var parentId = utils.getInputTextValue("#input-sync-export-gdrive-parentid");
googleHelper.upload(fileId, parentId, title, content, undefined, function(error, result) {
googleHelper.upload(fileId, parentId, title, content, undefined, undefined, function(error, result) {
if(error) {
callback(error);
return;
@ -120,7 +120,7 @@ define([
callback(undefined, false);
return;
}
googleHelper.upload(syncAttributes.id, undefined, uploadTitle, uploadContent, syncAttributes.etag, function(error, result) {
googleHelper.upload(syncAttributes.id, undefined, uploadTitle, uploadContent, undefined, syncAttributes.etag, function(error, result) {
if(error) {
callback(error, true);
return;
@ -245,7 +245,8 @@ define([
};
gdriveProvider.publish = function(publishAttributes, title, content, callback) {
googleHelper.upload(publishAttributes.id, undefined, publishAttributes.fileName || title, content, undefined, function(error, result) {
var contentType = publishAttributes.format != "markdown" ? 'text/html' : undefined;
googleHelper.upload(publishAttributes.id, undefined, publishAttributes.fileName || title, content, contentType, undefined, function(error, result) {
if(error) {
callback(error);
return;
@ -493,7 +494,7 @@ define([
}
localStorage.removeItem(PROVIDER_GDRIVE + ".state");
if(state.action == "create") {
googleHelper.upload(undefined, state.folderId, GDRIVE_DEFAULT_FILE_TITLE, settings.defaultContent, undefined, function(error, file) {
googleHelper.upload(undefined, state.folderId, GDRIVE_DEFAULT_FILE_TITLE, settings.defaultContent, undefined, undefined, function(error, file) {
if(error) {
return;
}