Skip to content

Commit 77cb8fb

Browse files
authored
Merge pull request #758 from contentstack/bugfix/beta-release
refactor:resolved PR comments
2 parents 7b93470 + 96072ab commit 77cb8fb

File tree

8 files changed

+16
-15
lines changed

8 files changed

+16
-15
lines changed

.talismanrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ fileignoreconfig:
8383
checksum: 4abcc89c75b7ddca8128fd72faafbb9b159f02611d96325bcd355283074ce287
8484
- filename: ui/src/components/ContentMapper/index.scss
8585
checksum: 46f8fde3b745feba40943f00d8d52714d0f320202c86b62f6c5ded73c2dbcf4c
86-
87-
86+
- filename: ui/src/utilities/constants.ts
87+
checksum: faac1367b4d80e022d4b7a165f9d2ac8bfd428f1a91af849064992ae2b3d6b1f
88+
- filename: ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx
89+
checksum: 988d93b93768ef0909305590ab0b89456333b9937ec12828edf23163f8640dfc
8890
fileignoreconfig:
8991
- filename: api/src/services/migration.service.ts
9092
checksum: abae249cacfab5c67e2d18a645c852649da2339954f26ae0f88c8698bdc016e6

api/src/services/globalField.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const createGlobalField = async ({
4646
const filePath = path.join(process.cwd(),globalSave, GLOBAL_FIELDS_FILE_NAME);
4747
const globalfields = res?.data?.global_fields || [];
4848

49-
let fileGlobalFields : any[]= []
49+
let fileGlobalFields = []
5050
if (fs.existsSync(filePath)) {
5151
const globalFieldSchema = await fs.promises.readFile(filePath, 'utf8');
5252
try {

api/src/services/migration.service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,10 +732,7 @@ const getAuditData = async (req: Request): Promise<any> => {
732732
if (!safeEntriesSelectFieldPath.startsWith(auditLogPath)) {
733733
throw new BadRequestError('Access to this file is not allowed.');
734734
}
735-
// Additional path traversal prevention
736-
if (!safeEntriesSelectFieldPath.startsWith(auditLogPath) || safeEntriesSelectFieldPath.includes('..')) {
737-
throw new BadRequestError('Access to this file is not allowed.');
738-
}
735+
739736
const fileContent = await fsPromises?.readFile(safeEntriesSelectFieldPath, 'utf8');
740737
try {
741738
if (typeof fileContent === 'string') {

ui/src/components/AdvancePropertise/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const AdvancePropertise = (props: SchemaProps) => {
6767
value: item
6868
}));
6969

70-
const referencedItems = props?.data?.refrenceTo?.map((item: string) => ({
70+
const referencedItems = props?.data?.referenceTo?.map((item: string) => ({
7171
label: item,
7272
value: item
7373
}));

ui/src/components/ContentMapper/contentMapper.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export interface FieldMapType {
6767
contentstackUid: string;
6868
_invalid?: boolean;
6969
backupFieldUid: string;
70-
refrenceTo: string[];
70+
referenceTo: string[];
7171
}
7272

7373
export interface Advanced {

ui/src/components/ContentMapper/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref:
325325
// Make title and url field non editable
326326
useEffect(() => {
327327
tableData?.forEach((field) => {
328-
if(field?.backupFieldType === 'reference' && field?.refrenceTo?.length === 0) {
328+
if(field?.backupFieldType === 'reference' && field?.referenceTo?.length === 0) {
329329
field._canSelect = false;
330330
}
331331
else if (field?.backupFieldType !== 'text' && field?.backupFieldType !== 'url') {
@@ -850,8 +850,8 @@ const ContentMapper = forwardRef(({ handleStepChange }: contentMapperProps, ref:
850850
setIsDropDownChanged(checkBoxChanged);
851851
const newTableData = tableData?.map?.((row: any) => {
852852
if (row?.uid === rowId && row?.contentstackFieldUid === rowContentstackFieldUid) {
853-
if (row?.refrenceTo) {
854-
row.refrenceTo = updatedSettings?.referenedItems;
853+
if (row?.referenceTo) {
854+
row.referenceTo = updatedSettings?.referenedItems;
855855
}
856856
return { ...row, advanced: { ...row?.advanced, ...updatedSettings } };
857857
}

ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useDispatch, useSelector } from 'react-redux';
1414
import { RootState } from '../../../store';
1515
import { updateNewMigrationData } from '../../../store/slice/migrationDataSlice';
1616
import { DEFAULT_DROPDOWN, IDropDown, INewMigration } from '../../../context/app/app.interface';
17+
import {CS_ENTRIES} from '../../../utilities/constants';
1718

1819
export type ExistingFieldType = {
1920
[key: string]: { label: string; value: string };
@@ -222,9 +223,9 @@ const Mapper = ({
222223
}
223224
else if (type === 'csLocale' && selectedLocaleKey) {
224225

225-
if(updatedMappings?.['undefined'] === existingLocale?.[index]?.label){
226+
if(updatedMappings?.[CS_ENTRIES?.UNMAPPED_LOCALE_KEY] === existingLocale?.[index]?.label){
226227
updatedMappings[selectedLocaleKey] = existingLocale?.[index]?.label;
227-
delete updatedMappings?.['undefined'];
228+
delete updatedMappings?.[CS_ENTRIES?.UNMAPPED_LOCALE_KEY];
228229
}else{
229230
updatedMappings[selectedLocaleKey] = existingLocale?.[index]?.label
230231
? existingLocale?.[index]?.label

ui/src/utilities/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export const CS_ENTRIES = {
6565
url: '500'
6666
},
6767
ERROR_HANDLER: 'error_handler',
68-
ADD_STACK: 'add_stack'
68+
ADD_STACK: 'add_stack',
69+
UNMAPPED_LOCALE_KEY: 'undefined'
6970
};
7071

7172
export const UPLOAD_FILE_RELATIVE_URL = process.env.REACT_APP_UPLOAD_SERVER;

0 commit comments

Comments
 (0)