(path: &str)
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | fn validate_write_path(path: &str) -> io::Result<()> { |
| 118 | if path.starts_with("user://") { |
| 119 | validate_virtual_asset_path(path)?; |
| 120 | return Ok(()); |
| 121 | } |
| 122 | |
| 123 | if Path::new(path).is_absolute() { |
| 124 | return Ok(()); |
| 125 | } |
| 126 | |
| 127 | Err(io::Error::new( |
| 128 | io::ErrorKind::PermissionDenied, |
| 129 | "writes are restricted to `user://` or absolute paths", |
| 130 | )) |
| 131 | } |
| 132 |
no test coverage detected