Skip to content

Commit 17c83ec

Browse files
committed
Fix bug in sending files uploaded using screenshot option
1 parent d662f01 commit 17c83ec

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Notification/Telegram.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ function tempnam_sfx($path, $suffix)
3434
return $file;
3535
}
3636

37+
function clean($string)
38+
{
39+
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
40+
return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
41+
}
42+
3743
// Overloaded classes
3844

3945
class Telegram extends Base implements NotificationInterface
@@ -178,7 +184,7 @@ protected function sendMessage($apikey, $bot_username, $chat_id, array $project,
178184
$file_name = $eventData['file']['name'];
179185
$is_image = $eventData['file']['is_image'];
180186

181-
$attachment = tempnam_sfx(sys_get_temp_dir(), $file_name);
187+
$attachment = tempnam_sfx(sys_get_temp_dir(), clean($file_name));
182188
file_put_contents($attachment, file_get_contents($file_path));
183189
}
184190

Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getPluginAuthor()
4242

4343
public function getPluginVersion()
4444
{
45-
return '1.1.0';
45+
return '1.2.0';
4646
}
4747

4848
public function getPluginHomepage()

0 commit comments

Comments
 (0)