Atom: Uncaught TypeError: path.replace is not a function

Created on 29 Dec 2016  路  12Comments  路  Source: file-icons/atom

Atom Version: 1.12.7
Electron Version: 1.3.13
System: Microsoft Windows 10 Home
Thrown From: file-icons package, v2.0.0

Stack Trace

Uncaught TypeError: path.replace is not a function

At C:\Users\krist\AppData\Local\atom\app-1.12.7\resources\app.asar\node_modules\git-utils\lib\git.js:199

TypeError: path.replace is not a function
    at Repository.relativize (C:\Users\krist\AppData\Local\atom\app-1.12.7\resources\app.asar\node_modules\git-utils\lib\git.js:199:19)
    at GitRepository.module.exports.GitRepository.relativize (C:\Users\krist\AppData\Local\atom\app-1.12.7\resources\app.asar\src\git-repository.js:163:29)
    at GitRepository.module.exports.GitRepository.getCachedPathStatus (C:\Users\krist\AppData\Local\atom\app-1.12.7\resources\app.asar\src\git-repository.js:271:33)
    at File.watchRepo (C:\Users\krist\.atom\packages\file-icons\lib\filesystem\file.js:395:27)
    at new File (C:\Users\krist\.atom\packages\file-icons\lib\filesystem\file.js:31:8)
    at FileRegistry.get (C:\Users\krist\.atom\packages\file-icons\lib\filesystem\file-registry.js:65:17)
    at new Tab (C:\Users\krist\.atom\packages\file-icons\lib\consumers\tab.js:15:32)
    at Tabs.add (C:\Users\krist\.atom\packages\file-icons\lib\consumers\tabs.js:77:16)
    at disposables.UI.delay.onOpenEditor.editor (C:\Users\krist\.atom\packages\file-icons\lib\consumers\tabs.js:25:10)
    at Immediate._ (C:\Users\krist\.atom\packages\file-icons\lib\ui.js:70:38)
    at runCallback (timers.js:574:20)
    at tryOnImmediate (timers.js:554:5)
    at processImmediate [as _immediateCallback] (timers.js:533:5)
bug

Most helpful comment

I've published a hotfix. Please let me know if this persists after updating.

I'll have a closer look as to why this is happening.

All 12 comments

Have you reloaded Atom?

Cleared cache & reloaded

Same issue, just installed update.

Same issue, Win7. Rollback to 1.7.25 still works.

Ugh, I'm guessing this is related to Windows.

Hang on, gonna chuck a try/catch in there.

I've published a hotfix. Please let me know if this persists after updating.

I'll have a closer look as to why this is happening.

Success with 2.0.1

Thank Christ for that.

Oh! So fast. Fix is released before I read this issue 馃ぃ
Thank you very much 馃檱

Yes, solved it!

All good now (:

Found the culprit:

Repository::relativize = (path) ->
  return path unless path

  if process.platform is 'win32'
    path = path.replace(/\\/g, '/')
  else
    return path unless path[0] is '/'

There's no typechecking performed here, which I'm guessing should really be fixed...

EDIT: Or I could, you know, use the correct accessor:

-status = repo.getCachedPathStatus(path);
+status = repo.getCachedPathStatus(this.path);

... derp. I'm an idiot.

Was this page helpful?
0 / 5 - 0 ratings