Skip to content

Commit dd1219a

Browse files
committed
Fixed files method using the wrong param for headers
1 parent ff9b078 commit dd1219a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All Notable changes to `php-lxd` will be documented in this file.
44

55
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
66

7+
# [0.15.1]
8+
9+
## Fixed
10+
- Files method using the wrong param for headers
11+
712
# [0.15.0]
813

914
## Added

src/Endpoint/Instance/Files.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function read($name, $filepath)
3939
* @param string $data Data to write to the file
4040
* @return object
4141
*/
42-
public function write($name, $filepath, $data, $uid = null, $gid = null, $mode = null)
42+
public function write($name, $filepath, $data, $uid = null, $gid = null, $mode = null, $type = "file")
4343
{
4444
$headers = [];
4545

@@ -55,7 +55,11 @@ public function write($name, $filepath, $data, $uid = null, $gid = null, $mode =
5555
$headers['X-LXD-mode'] = $mode;
5656
}
5757

58-
return $this->post($this->getEndpoint().$name.'/files?path='.$filepath, $data, $headers);
58+
if (is_string($type)) {
59+
$headers['X-LXD-type'] = $type;
60+
}
61+
62+
return $this->post($this->getEndpoint().$name.'/files?path='.$filepath, $data, [], $headers);
5963
}
6064

6165
/**

0 commit comments

Comments
 (0)