Skip to content

chore: validate user input for tv maze urls #1865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demos/default/pages/api/shows/[...params].js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default async (req, res) => {
const id = params[0]

// Get the data
const fetchRes = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const fetchRes = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await fetchRes.json()

// If show was found, return it
Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/api/shows/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async (req, res) => {
const { id } = query

// Get the data
const fetchRes = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const fetchRes = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await fetchRes.json()

// If show was found, return it
Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/getServerSideProps/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const getServerSideProps = async ({ params }) => {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()

// Set error code if show item could not be found
Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/getServerSideProps/all/[[...slug]].js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const getServerSideProps = async ({ params }) => {
// The ID to render
const { slug } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${slug[0]}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(slug[0])}`)
const data = await res.json()

// Set error code if show item could not be found
Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/getStaticProps/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getStaticProps({ params }) {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()
const time = new Date().toLocaleTimeString()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function getStaticProps({ params }) {
const { slug } = params
const id = slug[slug.length - 1]

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()
const time = new Date().toLocaleTimeString()

Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/getStaticProps/withFallback/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function getStaticProps({ params }) {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()
const time = new Date().toLocaleTimeString()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function getStaticProps({ params }) {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()
const time = new Date().toLocaleTimeString()

Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/getStaticProps/withRevalidate/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function getStaticProps({ params }) {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()
const time = new Date().toLocaleTimeString()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function getStaticProps({ params }) {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()
const time = new Date().toLocaleTimeString()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function getStaticProps({ params }) {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()
const time = new Date().toLocaleTimeString()

Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/shows/[...params].js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CatchAll.getInitialProps = async ({ res: req, query }) => {
const id = params[0]

// Get the data
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()

// Set error code if show item could not be found
Expand Down
2 changes: 1 addition & 1 deletion demos/default/pages/shows/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Show.getInitialProps = async ({ res: req, query }) => {
const { id } = query

// Get the data
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()

// Set error code if show item could not be found
Expand Down
2 changes: 1 addition & 1 deletion demos/middleware/pages/shows/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const getServerSideProps = async ({ params, req }) => {
// The ID to render
const { id } = params
console.log(req.headers)
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()

// Set error code if show item could not be found
Expand Down
2 changes: 1 addition & 1 deletion demos/middleware/pages/shows/static/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function getStaticProps({ params }) {
// The ID to render
const { id } = params

const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
const res = await fetch(`https://tvproxy.netlify.app/shows/${Number(id)}`)
const data = await res.json()

return {
Expand Down
Loading