Skip to content

Commit 067d0ea

Browse files
committed
Fixed exception when downloading mail attachment of a file that does not exist
1 parent 9cc3066 commit 067d0ea

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/Libraries/SmartStore.Data/Migrations/201603121451066_ThirdPartyEmailHandOver.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
212212
"E-Mail Adressen an",
213213
"Specifies the email addresses where to send the data.",
214214
"Legt die E-Mail Adressen fest, an die die Daten verschickt werden soll.");
215+
216+
builder.AddOrUpdate("Admin.Common.FileNotFound", "File not found", "Datei nicht gefunden");
215217
}
216218
}
217219
}

src/Presentation/SmartStore.Web/Administration/Controllers/QueuedEmailController.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,18 @@ public ActionResult DownloadAttachment(int id)
279279
{
280280
path = CommonHelper.MapPath(VirtualPathUtility.ToAppRelative(path), false);
281281
}
282+
283+
if (!System.IO.File.Exists(path))
284+
{
285+
NotifyError(string.Concat(T("Admin.Common.FileNotFound"), ": ", path));
286+
287+
var referrer = Services.WebHelper.GetUrlReferrer();
288+
if (referrer.HasValue())
289+
return Redirect(referrer);
290+
291+
return RedirectToAction("List");
292+
}
293+
282294
return File(path, qea.MimeType, qea.Name);
283295
}
284296

@@ -290,7 +302,6 @@ public ActionResult DownloadAttachment(int id)
290302

291303
NotifyError(T("Admin.System.QueuedEmails.CouldNotDownloadAttachment"));
292304
return RedirectToAction("List");
293-
294305
}
295306
}
296307
}

0 commit comments

Comments
 (0)