Set content type to 'text/html' when publishing to Google Drive using HTML or template output
This commit is contained in:
parent
100ccd4f5d
commit
d172aaad1b
@ -99,7 +99,7 @@ define([
|
|||||||
task.enqueue();
|
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 result = undefined;
|
||||||
var task = new AsyncTask();
|
var task = new AsyncTask();
|
||||||
connect(task);
|
connect(task);
|
||||||
@ -108,7 +108,7 @@ define([
|
|||||||
var boundary = '-------314159265358979323846';
|
var boundary = '-------314159265358979323846';
|
||||||
var delimiter = "\r\n--" + boundary + "\r\n";
|
var delimiter = "\r\n--" + boundary + "\r\n";
|
||||||
var close_delim = "\r\n--" + boundary + "--";
|
var close_delim = "\r\n--" + boundary + "--";
|
||||||
var contentType = 'text/x-markdown';
|
contentType = contentType || 'text/x-markdown';
|
||||||
var metadata = {
|
var metadata = {
|
||||||
title: title,
|
title: title,
|
||||||
mimeType: contentType
|
mimeType: contentType
|
||||||
|
@ -92,7 +92,7 @@ define([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var parentId = utils.getInputTextValue("#input-sync-export-gdrive-parentid");
|
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) {
|
if(error) {
|
||||||
callback(error);
|
callback(error);
|
||||||
return;
|
return;
|
||||||
@ -120,7 +120,7 @@ define([
|
|||||||
callback(undefined, false);
|
callback(undefined, false);
|
||||||
return;
|
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) {
|
if(error) {
|
||||||
callback(error, true);
|
callback(error, true);
|
||||||
return;
|
return;
|
||||||
@ -245,7 +245,8 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
gdriveProvider.publish = function(publishAttributes, title, content, callback) {
|
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) {
|
if(error) {
|
||||||
callback(error);
|
callback(error);
|
||||||
return;
|
return;
|
||||||
@ -493,7 +494,7 @@ define([
|
|||||||
}
|
}
|
||||||
localStorage.removeItem(PROVIDER_GDRIVE + ".state");
|
localStorage.removeItem(PROVIDER_GDRIVE + ".state");
|
||||||
if(state.action == "create") {
|
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) {
|
if(error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user