Check ReferencesParent before calling MakeAbsoluteFilePath
This commit is contained in:
parent
7692edf50e
commit
9c88a5c1ab
1 changed files with 15 additions and 6 deletions
|
@ -120,6 +120,20 @@ bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
|
||||||
return succeed;
|
return succeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::FilePath MakePathAbsolute(const base::FilePath& path) {
|
||||||
|
if (!path.ReferencesParent()) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
base::FilePath absolute_path = MakeAbsoluteFilePath(path);
|
||||||
|
// MakeAbsoluteFilePath returns an empty path on failures so use original path
|
||||||
|
if (absolute_path.empty()) {
|
||||||
|
return path;
|
||||||
|
} else {
|
||||||
|
return absolute_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
bool IsTemplateFilename(const base::FilePath& path) {
|
bool IsTemplateFilename(const base::FilePath& path) {
|
||||||
return (base::MatchPattern(path.value(), "*Template.*") ||
|
return (base::MatchPattern(path.value(), "*Template.*") ||
|
||||||
|
@ -255,12 +269,7 @@ mate::Handle<NativeImage> NativeImage::CreateFromJPEG(
|
||||||
mate::Handle<NativeImage> NativeImage::CreateFromPath(
|
mate::Handle<NativeImage> NativeImage::CreateFromPath(
|
||||||
v8::Isolate* isolate, const base::FilePath& path) {
|
v8::Isolate* isolate, const base::FilePath& path) {
|
||||||
gfx::ImageSkia image_skia;
|
gfx::ImageSkia image_skia;
|
||||||
|
base::FilePath absolute_path = MakePathAbsolute(path);
|
||||||
base::FilePath absolute_path = MakeAbsoluteFilePath(path);
|
|
||||||
// MakeAbsoluteFilePath returns an empty path on failures so use original path
|
|
||||||
if (absolute_path.empty()) {
|
|
||||||
absolute_path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (absolute_path.MatchesExtension(FILE_PATH_LITERAL(".ico"))) {
|
if (absolute_path.MatchesExtension(FILE_PATH_LITERAL(".ico"))) {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
Loading…
Reference in a new issue