Skip to content

Commit

Permalink
update apiDelete to delete everything, not just files
Browse files Browse the repository at this point in the history
  • Loading branch information
taheralfayad committed Jun 6, 2024
1 parent 95037a4 commit 6b2049e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Lms/Canvas/CanvasApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,8 @@ public function apiPut($url, $options)
public function apiDelete($url) {
$lmsResponse = new LmsResponse();

if (strpos($url, 'https://') === false) {
$pattern = '/\/files\/\d+/';

preg_match($pattern, $url, $matches);

$url = "https://" . $this->baseUrl . "/api/v1/" . $matches[0];
if (strpos($url, 'https://') === false) {
$url = "https://{$this->baseUrl}/api/v1/{$url}";
}

$response = $this->httpClient->request('DELETE', $url);
Expand Down

0 comments on commit 6b2049e

Please sign in to comment.