uebersicht icon indicating copy to clipboard operation
uebersicht copied to clipboard

Bug in handling of widget path if the path contains folder named "src"

Open brujoand opened this issue 5 years ago • 2 comments

Widgetpath_bad: /Users/brujoand/src/brujoand/dotfiles/config/uebersicht/ Widgetpath_good: /Users/brujoand/uebersicht

Starting Uebersicht with the "bad" path gives no widgets, starting it with the good path let's everything work fine. The "good" path is just a copy of the "bad" path. And they contain morning.widget/index.coffee.

I'm no JS guru so I couldn't really see where this bug could be located but should be farely easy to replicate by creating a similar folder structure.

I tried this though, and could not reproduce it. Until I named one of the folders "src". So from what I can gather, having a widget path that contains a folder named source will break the loading of widgets.

Edit: huh, I guess it is this one https://github.com/felixhageloh/uebersicht/blob/master/server/src/resolveWidget.js#L6

Is this the intended behaviour?

brujoand avatar Aug 28 '19 07:08 brujoand

It's (somewhat) desired behavior: any path containing src or lib or node_modules will be ignored. This allows for having a folder inside your widget directory that contains extra js files which are not treaded as widgets: https://github.com/felixhageloh/uebersicht#writing-widgets

I guess the behavior could be improved tho, by checking that src is not a part of the widget path itself

felixhageloh avatar Sep 10 '19 07:09 felixhageloh

Yeah that makes sense. I think excluding the widget path from being checked for src is probably a good approach.

brujoand avatar Sep 30 '19 14:09 brujoand