From 50b1223e30507f33fd5303ed5af5d7adc1c32e54 Mon Sep 17 00:00:00 2001 From: Marco Audiffredi Date: Tue, 13 May 2025 11:15:16 +0200 Subject: [PATCH] modifica per logo in cartella con meno di 5 caratteri --- ApiPolo/Controllers/PoloController.cs | 16 ++++++++++++++-- ApiPolo/Startup.cs | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ApiPolo/Controllers/PoloController.cs b/ApiPolo/Controllers/PoloController.cs index 5c474ae..1d55454 100644 --- a/ApiPolo/Controllers/PoloController.cs +++ b/ApiPolo/Controllers/PoloController.cs @@ -14325,16 +14325,28 @@ namespace ApiPolo.Controllers private async Task readImgAndSave(string azienda, string tecnico, string pathSrv) { _VT_DatiAzi = _VT_DatiAzienda.Dati; - var t = await _VT_DatiAzi.Where(t => t.azienda.Equals(azienda) && t.tecnico.Equals(tecnico)).ToListAsync(); + var t = await _VT_DatiAzi.Where(t => !string.IsNullOrEmpty(t.azienda) && t.azienda.Equals(azienda) + && !string.IsNullOrEmpty(t.tecnico) && t.tecnico.Equals(tecnico)).ToListAsync(); DatiAzienda model = t.First(); string path = string.Empty; string nomeFile = string.Empty; nomeFile = getNomeFile(model.url_logo); + if(!string.IsNullOrEmpty(nomeFile)) + { + nomeFile = nomeFile.Trim(); + } + + //previene aziende più corte di 5 caratteri + string aziendaFolder = string.Empty; + if (!string.IsNullOrEmpty(azienda)) + { + aziendaFolder = azienda.Trim(); + } path = pathSrv; - path = path +@"\"+azienda+ @"\" + nomeFile; + path = path +@"\"+ aziendaFolder + @"\" + nomeFile; SaveByteArrayToFileWithBinaryWriter(model.logo, path); return model; } diff --git a/ApiPolo/Startup.cs b/ApiPolo/Startup.cs index 03fa549..c8b17bd 100644 --- a/ApiPolo/Startup.cs +++ b/ApiPolo/Startup.cs @@ -150,7 +150,7 @@ namespace ApiPolo string dt = oggi.ToString(); gen.SwaggerDoc("v1", new OpenApiInfo { Title = "API VIRTUAL TASK - v.app 1.30", Version = dt }); - var filePath = Path.Combine(System.AppContext.BaseDirectory, "ApiPolo.xml"); + var filePath = Path.Combine(System.AppContext.BaseDirectory, "Api_VT.xml"); gen.IncludeXmlComments(filePath); });