[gnome-shell] screenshot: Use separate error when disk writes are locked down



commit 1aee0516d67060c3fa6d68b72ebab0f1c84233ef
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jan 25 12:38:51 2021 +0100

    screenshot: Use separate error when disk writes are locked down
    
    The most likely reason for rejecting a screenshot request is that
    there's an ongoing operation from the same sender. Still, we shouldn't
    assume that that is the case and return an appropriate error when
    writing to disk is disabled via lockdown settings.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3618
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1589>

 js/ui/screenshot.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js
index 787e60f9af..29cf7c8977 100644
--- a/js/ui/screenshot.js
+++ b/js/ui/screenshot.js
@@ -36,11 +36,16 @@ var ScreenshotService = class {
             lockedDown = this._lockdownSettings.get_boolean('disable-save-to-disk');
 
         let sender = invocation.get_sender();
-        if (this._screenShooter.has(sender) || lockedDown) {
+        if (this._screenShooter.has(sender)) {
             invocation.return_error_literal(
                 Gio.IOErrorEnum, Gio.IOErrorEnum.BUSY,
                 'There is an ongoing operation for this sender');
             return null;
+        } else if (lockedDown) {
+            invocation.return_error_literal(
+                Gio.IOErrorEnum, Gio.IOErrorEnum.PERMISSION_DENIED,
+                'Saving to disk is disabled');
+            return null;
         }
 
         let shooter = new Shell.Screenshot();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]