Closed Edu4rdSHL closed 2 months ago
I'm having the same issue, I had to git checkout 3947ceb61737df03e340196f19d900e4bb268764
for it to work again. So whatever commits happened after 3947ceb have broken this extension.
Same issue here, pretty sure that https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator/commit/8203d3ffd0a7bee888dd50e63a5fa661040d091b broke the extension.
After digging more into the code, I believe that query_info_async()
is used in a wrong way @andyholmes.
Firstly, you forgot to catch the exception that was rejected from the promised:
const contentType = await new Promise((resolve, reject) => file.query_info_async(null, (obj, res) => {
try {
const fileInfo = obj.query_info_finish(res);
resolve(fileInfo.get_content_type());
} catch (e) {
reject(e);
}
// This catch
}).catch(e => {
console.error(e);
})
);
Once you do that, you will see the error from query_info_async()
:
I think it would look something like this instead:
const contentType = await file.query_info_async('*', FileQueryInfoFlags.NONE, GLib.PRIORITY_DEFAULT, null, (obj, res) => {
try {
const fileInfo = obj.query_info_finish(res);
return fileInfo.get_content_type();
} catch (e) {
console.error(e);
}
})
);
Please refer to the docs for more info (The read()
function in the same file make an usage of the function as well so you can also refer to that.
And one more thing, please check the contentType
before performing any operation on it cause it could be null, you should do something like this imo:
if (contentType && !contentType.startsWith('image/') && !contentType.startsWith('text/'))
Since the author stated
DO NOT open unsolicited PRs unless they are for updating translations
so I just made a fork here: https://github.com/ken-kuro/gnome-shell-extension-clipboard-indicator
Good catch, thanks for the investigation!
@ken-kuro Thank you for investigating and fixing the issue. Can you kindly open a PR and I will upload it to e.g.o?
Thanks 🙏
I'm happy to, already made one 😄
Hi,
After #454 I'm facing this problem after a while using the keyboard:
and it stops working as shown in the image:![image](https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator/assets/32582878/57642712-3cf0-4149-a802-e88933eeb29d)