Skip to content

Commit

Permalink
do not stringify an ics string
Browse files Browse the repository at this point in the history
  • Loading branch information
friedger committed Feb 12, 2019
1 parent 2b1c23e commit 3738618
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/flow/io/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,14 @@ function fetchFromBlockstack(src, config, privateKey, errorData) {
return str
},
error => {
console.error(errorData)
console.error(error)
console.error(
'failed to fetch ',
src,
config,
!!privateKey,
error,
errorData
)
return Promise.reject(
new Error(`Couldn't fetch from fetchFromBlockstack`)
)
Expand Down Expand Up @@ -428,8 +434,8 @@ export function loadPublicCalendar(calendarName, username) {
})
}

function publishCalendar(events, filepath, contentType) {
putOnBlockstack(filepath, JSON.stringify(events), {
function publishCalendar(eventsString, filepath, contentType) {
putOnBlockstack(filepath, eventsString, {
encrypt: false,
contentType,
}).then(
Expand All @@ -454,7 +460,11 @@ export function publishEvents(param, updatePublicEvents) {
publicEvents
)
if (republish) {
publishCalendar(newPublicEvents, publicEventPath, 'text/json')
publishCalendar(
JSON.stringify(newPublicEvents),
publicEventPath,
'text/json'
)
var ics = icsFromEvents(newPublicEvents)
publishCalendar(ics, publicEventPath + '.ics', 'text/calendar')
} else {
Expand Down

0 comments on commit 3738618

Please sign in to comment.