Skip to content

Commit

Permalink
Merge pull request #148 from rushi-tekdi/release-1.0.0
Browse files Browse the repository at this point in the history
PS-2796 ZIP file large 7Mb not getting uploaded
  • Loading branch information
itsvick authored Dec 11, 2024
2 parents 1116116 + 48f0d9f commit 10747f1
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/pages/api/content-upload/get-status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
export default async function handler(req, res) {
if (req.method === "POST") {
try {
const { contenturl } = req.body;

// Split the URL by slashes and extract the second last part
const parts = contenturl.split("/");
const doId = parts.length > 2 ? parts[parts.length - 2] : null;
if (doId) {
const baseURL = process.env.BASE_URL;
const authApiToken = process.env.AUTH_API_TOKEN;
const tenantId = process.env.NEXT_PUBLIC_TENANT_ID;

const axios = require("axios");

let config = {
method: "get",
maxBodyLength: Infinity,
url: `${baseURL}/api/content/v1/read/${doId}?fields=artifactUrl`,
headers: {
tenantid: tenantId,
Authorization: `Bearer ${authApiToken}`,
},
};

await axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
if (response?.data?.result?.content?.artifactUrl != null) {
res.status(200).json({ doId, success: true });
} else {
res.status(200).json({ doId, success: false });
}
})
.catch((error) => {
res.status(200).json({ doId, success: false });
});
} else {
res.status(200).json({ doId, success: false });
}
} catch (error) {
console.error("Error", error);
res.status(500).json({ error: error.message });
}
} else {
res.status(405).json({ error: "Method not allowed" });
}
}

0 comments on commit 10747f1

Please sign in to comment.