Skip to content
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 ui/src/components/LegacyCms/Actions/LoadUploadFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const LoadUploadFile = (props: LoadUploadFileProps) => {
setProgressPercentage(30);
setShowProgress(true);

const res: any = await fileValidation();
const res: any = await fileValidation(projectId);
if(res?.status === 200){
setIsValidated(true);
setValidationMessage('Validated');
Expand Down
12 changes: 10 additions & 2 deletions ui/src/services/api/upload.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import axios from 'axios';
import { UPLOAD_FILE_RELATIVE_URL } from '../../utilities/constants';
import { User, SmsToken } from '../../pages/Login/login.interface';
import { API_VERSION } from '../../utilities/constants';
import { getDataFromLocalStorage } from '../../utilities/functions';

//Axios Calls for Upload server
export const getCall = async (url: string, options?: any) => {
Expand Down Expand Up @@ -36,9 +37,16 @@ export const uploadFilePath = () => {
return `${UPLOAD_FILE_RELATIVE_URL}upload`;
};

export const fileValidation = () => {
export const fileValidation = (projectId: string) => {
try {
return getCall(`${UPLOAD_FILE_RELATIVE_URL}validator`);
const options = {
headers: {
'app_token': getDataFromLocalStorage('app_token'),
'projectId': projectId
},

};
return getCall(`${UPLOAD_FILE_RELATIVE_URL}validator`, options);
} catch (error) {
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion uplaode-api/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ router.post('/upload', upload.single('file'), async function (req: Request, res:
// deepcode ignore NoRateLimitingForExpensiveWebOperation: <alredy implemetes>
router.get('/validator', express.json(), fileOperationLimiter, async function (req: Request, res: Response) {
try {
const projectId: string | string[] = req?.body?.projectId ?? "";
const projectId: string | string[] = req?.headers?.projectid ?? "";
const app_token: string | string[] = req?.headers?.app_token ?? "";
const cmsType = config?.cmsType?.toLowerCase();

Expand Down