lexrus / LTFinderButtons

My Finder buttons collection for macOS.
https://twitter.com/lexrus
MIT License
311 stars 21 forks source link

fixed a bug when decoding url #16

Closed thekoc closed 7 years ago

thekoc commented 7 years ago

In iTerm2FinderButton.app/Contents/Resources/Scripts/main.scpt, changed

if (!item) {
    try {
        return Finder.windows[0].target().url()
    } catch (e) {
        return urlPathToPosixPath(Finder.desktop().url())
    }
}

to

if (!item) {
    try {
        return urlPathToPosixPath(Finder.windows[0].target().url())
    } catch (e) {
        return urlPathToPosixPath(Finder.desktop().url())
    }
}

In both iTerm2FinderButton and TerminalFinderButton, changed

function urlPathToPosixPath(path) {
    return unescape(path)
        .replace(/^\/?file[:]\/+/i, '/')
        .replace(/(")/g, '\\$1')
}

to

function urlPathToPosixPath(path) {
    return decodeURIComponent(path)
        .replace(/^\/?file[:]\/+/i, '/')
        .replace(/(")/g, '\\$1')
}
lexrus commented 7 years ago

Merged. Mahalo.