Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
make sure files are file urls
Browse files Browse the repository at this point in the history
fixes #3296
auditors: @bbondy
  • Loading branch information
bridiver committed Aug 27, 2016
1 parent c46e7ec commit a38da51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/browser/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const messages = require('../../js/constants/messages')
const settings = require('../../js/constants/settings')
const dialog = electron.dialog
const appActions = require('../../js/actions/appActions')
const { fileUrl } = require('../../js/lib/appUrlUtil')
const menuUtil = require('./lib/menuUtil')
const getSetting = require('../../js/settings').getSetting
const locale = require('../locale')
Expand Down Expand Up @@ -44,7 +45,7 @@ const createFileSubmenu = (CommonMenu) => {
}, (paths) => {
if (paths) {
paths.forEach((path) => {
CommonMenu.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_NEW_FRAME, path])
CommonMenu.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_NEW_FRAME, fileUrl(path)])
})
}
})
Expand Down
6 changes: 3 additions & 3 deletions js/lib/appUrlUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const path = require('path')
const UrlUtil = require('./urlutil')
const config = require('../constants/config')

function fileUrl (str) {
module.exports.fileUrl = (str) => {
var pathName = path.resolve(str).replace(/\\/g, '/')

// Windows drive letter must be prefixed with a slash
Expand Down Expand Up @@ -43,8 +43,8 @@ module.exports.getExtensionsPath = function (extensionDir) {

module.exports.getIndexHTML = function () {
return process.env.NODE_ENV === 'development'
? fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index-dev.html')
: fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index.html')
? module.exports.fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index-dev.html')
: module.exports.fileUrl(path.resolve(__dirname, '..', '..') + '/app/extensions/brave/index.html')
}

/**
Expand Down

2 comments on commit a38da51

@bbondy
Copy link
Member

@bbondy bbondy commented on a38da51 Aug 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.