don't sanitize payload for storage on frontend (#1192)

main
Andrew Hayes 4 years ago committed by GitHub
parent 22e41c094a
commit 532f21b00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,11 +1,10 @@
import axios from 'axios'
import debounce from 'lodash.debounce'
import omitBy from 'lodash.omitby'
import ms from 'ms'
import { fileToDataURL } from './util'
import firebase from './client'
import { DEFAULT_CODE, DEFAULT_SETTINGS } from './constants'
import { DEFAULT_CODE } from './constants'
export const client = axios.create({
baseURL: `${process.env.NEXT_PUBLIC_API_URL || ''}/api`,
@ -130,15 +129,9 @@ function listSnippets(page) {
)
}
function isNotDefaultSetting(v, k) {
return v === DEFAULT_SETTINGS[k] || !Object.prototype.hasOwnProperty.call(DEFAULT_SETTINGS, k)
}
function updateSnippet(uid, state) {
const sanitized = omitBy(state, isNotDefaultSetting)
const data = {
...sanitized,
...state,
code: state.code != null ? state.code : DEFAULT_CODE,
}

Loading…
Cancel
Save