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

View File

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