From 741dc1eb0bff179901c68842df3781cb689aacc9 Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Mon, 25 Sep 2017 13:51:16 -0700 Subject: [PATCH] :wrench: Ensure correct path --- brightray/browser/win/notification_presenter_win.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/brightray/browser/win/notification_presenter_win.cc b/brightray/browser/win/notification_presenter_win.cc index a14a60aaa904..bb461709c8c0 100644 --- a/brightray/browser/win/notification_presenter_win.cc +++ b/brightray/browser/win/notification_presenter_win.cc @@ -12,6 +12,7 @@ #include "base/files/file_util.h" #include "base/md5.h" #include "base/strings/utf_string_conversions.h" +#include "base/time/time.h" #include "base/win/windows_version.h" #include "brightray/browser/win/notification_presenter_win7.h" #include "brightray/browser/win/windows_toast_notification.h" @@ -64,7 +65,15 @@ bool NotificationPresenterWin::Init() { base::string16 NotificationPresenterWin::SaveIconToFilesystem( const SkBitmap& icon, const GURL& origin) { - std::string filename = base::MD5String(origin.spec()) + ".png"; + std::string filename; + + if (origin.is_valid()) { + filename = base::MD5String(origin.spec()) + ".png"; + } else { + base::TimeTicks now = base::TimeTicks::Now(); + filename = std::to_string(now.ToInternalValue()) + ".png"; + } + base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToUTF16(filename)); if (base::PathExists(path)) return path.value();