[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] mediaplayer exception handling
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]> Wed, 22 Jul 2026 13:41:29 +0000
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a60c88932694_3819d23c580ac@gitlab-sidekiq-low-urgency-cpu-bound-v2-7d8cd68bcd-h5vkr.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
873add50 by Victor Emanouilov at 2026-07-22T13:24:03+00:00
[FIX] mediaplayer exception handling
---
* [FIX] mediaplayer exception handling
See merge request tikiwiki/tiki!10768
- - - - -
1 changed file:
- lib/wiki-plugins/wikiplugin_mediaplayer.php
Changes:
=====================================
lib/wiki-plugins/wikiplugin_mediaplayer.php
=====================================
@@ -5,7 +5,8 @@
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
use GuzzleHttp\Client;
-use GuzzleHttp\Exception\ClientException;
+use GuzzleHttp\Exception\ConnectException;
+use GuzzleHttp\Exception\RequestException;
use Tiki\Package\VendorHelper;
const AUDIO_ACCEPTED_FORMATS = ['mp3', 'ogg', 'wav', 'aac', 'flac', 'opus'];
@@ -167,10 +168,16 @@ function wikiplugin_mediaplayer($data, $params)
try {
$response = $client->head($sourceLink);
$headers = $response->getHeaders();
- } catch (ClientException $e) {
- $message = tr('PluginMediaPlayer: File %0 not found on the remote server.', $params['src']);
- if ($e->getResponse()->getStatusCode() !== 404) {
+ } catch (ConnectException $e) {
+ Feedback::error(tr('PluginMediaPlayer failed to reach the remote server: %0.', $e->getMessage()));
+ return '';
+ } catch (RequestException $e) {
+ if ($e->hasResponse() && $e->getResponse()->getStatusCode() === 404) {
+ $message = tr('PluginMediaPlayer: File %0 not found on the remote server.', $params['src']);
+ } elseif ($e->hasResponse()) {
$message = tr('PluginMediaPlayer failed to reach the remote server: %0.', $e->getResponse()->getReasonPhrase());
+ } else {
+ $message = tr('PluginMediaPlayer failed to reach the remote server: %0.', $e->getMessage());
}
Feedback::error($message);
return '';
@@ -264,7 +271,7 @@ function wikiplugin_mediaplayer($data, $params)
position: relative;
height: 900px;
}
-
+
.iframe-container iframe {
border: 0;
height: 100%;
@@ -273,19 +280,19 @@ function wikiplugin_mediaplayer($data, $params)
top: 0;
width: 100%;
}
-
+
@media (max-width: 767px) {
.iframe-container {
height: 500px;
- }
+ }
}
-
+
@media (min-width: 768px) AND (max-width: 991px) {
.iframe-container {
height: 600px;
}
}
-
+
@media (min-width: 992px) AND (max-width: 1209px){
.iframe-container {
height: 700px;
@@ -369,7 +376,7 @@ function wikiplugin_mediaplayer($data, $params)
} elseif ($params['type'] === 'pdf') {
$js = '
var found = false;
-$.each(navigator.plugins, function(i, plugins) { // navigator.plugins is unspecified according to https://developer.mozilla.org/fr/docs/Web/API/NavigatorPlugins/plugins . Something other in NavigatorPlugins may be standard.
+$.each(navigator.plugins, function(i, plugins) { // navigator.plugins is unspecified according to https://developer.mozilla.org/fr/docs/Web/API/NavigatorPlugins/plugins . Something other in NavigatorPlugins may be standard.
$.each(plugins, function(i, plugin) {
if (plugin.type === "application/pdf") {
found = true;
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/873add50a0536404e4b82b234866357798979039
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/873add50a0536404e4b82b234866357798979039
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs