Skip to content

Instantly share code, notes, and snippets.

@finngreig
Created May 20, 2022 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finngreig/3699afbe9d5f93a9c8bd81b3669b746e to your computer and use it in GitHub Desktop.
Save finngreig/3699afbe9d5f93a9c8bd81b3669b746e to your computer and use it in GitHub Desktop.
Code for Pipedream Notion data URI redirect
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