- added url encoding for S3 file urls;

This commit is contained in:
Vitalii Kiiko
2024-12-05 13:08:37 +01:00
parent cf19ea9d12
commit f072c3d6a6
2 changed files with 17 additions and 6 deletions

View File

@@ -36,7 +36,7 @@ const AddCompany = () => {
formState: { errors }, formState: { errors },
setValue, setValue,
watch, watch,
getValues trigger
} = useForm({ } = useForm({
defaultValues: {}, defaultValues: {},
mode: 'onChange' mode: 'onChange'
@@ -131,6 +131,7 @@ const AddCompany = () => {
} else { } else {
setEmptyValues(); setEmptyValues();
} }
trigger();
storeSet.main.unsetAsyncRequest(); storeSet.main.unsetAsyncRequest();
} }
@@ -207,7 +208,12 @@ const AddCompany = () => {
label={__('P.IVA', 'gepafin')} label={__('P.IVA', 'gepafin')}
control={control} control={control}
errors={errors} errors={errors}
config={{ required: __('È obbligatorio', 'gepafin') }} config={{
required: __('È obbligatorio', 'gepafin'),
validate: {
isPIVA
}
}}
/> />
<FormField <FormField

View File

@@ -118,13 +118,14 @@ const DomandaEditPreInstructor = () => {
const header = renderHeader(); const header = renderHeader();
const updateEvaluationValue = (value, path, maxValue) => { const updateEvaluationValue = (value, path, maxValue) => {
const pathEls = path.split('.');
let finalValue = value; let finalValue = value;
if (maxValue || maxValue === 0) { if (maxValue || maxValue === 0) {
finalValue = value > maxValue ? maxValue : value; finalValue = value > maxValue ? maxValue : value;
} }
const newData = wrap(data).set(path.split('.'), finalValue).value(); const newData = wrap(data).set(pathEls, finalValue).value();
setData(newData); setData(newData);
} }
@@ -242,7 +243,7 @@ const DomandaEditPreInstructor = () => {
case 'fileupload' : case 'fileupload' :
content = <ul> content = <ul>
{item.fieldValue.map(o => <li key={o.id}> {item.fieldValue.map(o => <li key={o.id}>
{o.filePath ? <a href={o.filePath}>{o.name}</a> : null} {o.filePath ? <a href={encodeURI(o.filePath)}>{o.name}</a> : null}
</li>)} </li>)}
</ul>; </ul>;
break; break;
@@ -512,7 +513,9 @@ const DomandaEditPreInstructor = () => {
<div className="appPageSection__iconActions"> <div className="appPageSection__iconActions">
{o.fileDetail && o.fileDetail.length === 1 {o.fileDetail && o.fileDetail.length === 1
? <Button icon="pi pi-eye" rounded ? <Button icon="pi pi-eye" rounded
onClick={() => window.open(o.fileDetail[0].filePath, '_blank').focus()} onClick={() => {
window.open(encodeURI(o.fileDetail[0].filePath), '_blank').focus()
}}
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> : null} aria-label={__('Mostra', 'gepafin')}/> : null}
<Button icon="pi pi-thumbs-up" rounded outlined <Button icon="pi pi-thumbs-up" rounded outlined
@@ -551,7 +554,9 @@ const DomandaEditPreInstructor = () => {
<div className="appPageSection__iconActions"> <div className="appPageSection__iconActions">
<ArchiveDocument ndg={data.ndg} fileId={k.id}/> <ArchiveDocument ndg={data.ndg} fileId={k.id}/>
<Button icon="pi pi-eye" rounded <Button icon="pi pi-eye" rounded
onClick={() => window.open(k.filePath, '_blank').focus()} onClick={() => {
window.open(encodeURI(k.filePath), '_blank').focus()
}}
outlined severity="info" outlined severity="info"
aria-label={__('Mostra', 'gepafin')}/> aria-label={__('Mostra', 'gepafin')}/>
</div> </div>