GUACAMOLE-724: Always resolve promise from setClipboard() (as documented).

Returning a value from the callback provided to finally() is not
sufficient to force promise resolution.
This commit is contained in:
Michael Jumper
2021-06-30 20:02:16 -07:00
parent c87bd6bb3e
commit fe44b55f10

View File

@@ -597,17 +597,13 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
* set. This promise is always resolved. * set. This promise is always resolved.
*/ */
service.setClipboard = function setClipboard(data) { service.setClipboard = function setClipboard(data) {
return setLocalClipboard(data).finally(() => { return setLocalClipboard(data)['catch'](angular.noop).finally(() => {
// Update internal clipboard and broadcast event notifying of // Update internal clipboard and broadcast event notifying of
// updated contents // updated contents
storedClipboardData(data); storedClipboardData(data);
$rootScope.$broadcast('guacClipboard', data); $rootScope.$broadcast('guacClipboard', data);
// Ensure promise is resolved (this function may be called from
// the promise rejection handler)
return data;
}); });
}; };