Code for Pipedream Notion data URI redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import validDataUrl from "valid-data-url" | |
export default defineComponent({ | |
async run({ steps, $ }) { | |
const b64Uri = steps.trigger.event.query.uri; | |
if (validDataUrl(b64Uri)) { | |
await $.respond({ | |
status: 302, | |
headers: { | |
"Location": b64Uri | |
} | |
}) | |
} else { | |
await $.respond({ | |
status: 400, | |
body: "Invalid Data URI" | |
}) | |
} | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment