Skip to content

Commit

Permalink
fix: fix file exists (#228)
Browse files Browse the repository at this point in the history
* fix: fix file exists

* chore: rename variables
  • Loading branch information
gnkz authored Nov 7, 2023
1 parent 734f005 commit c02feb1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/_internal/Fs.sol
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,16 @@ library fs {
} catch Error(string memory) {
return Ok(false);
} catch (bytes memory reason) {
bytes4 selector = 0x0bc44503;
string memory errorMessage =
bytes32 errorHash = keccak256(bytes(abi.decode(removeSelector(reason), (string))));
string memory linuxErrorMessage =
string.concat("The path \"", path, "\" is not allowed to be accessed for read operations.");
bytes32 errorHash = keccak256(abi.encodeWithSelector(selector, errorMessage));
if (keccak256(reason) == errorHash) {
return FsErrors.Forbidden(errorMessage).toBoolResult();
bytes32 linuxErrorHash = keccak256(bytes(linuxErrorMessage));

string memory macErrorMessage =
string.concat("the path ", path, " is not allowed to be accessed for read operations");
bytes32 macErrorHash = keccak256(bytes(macErrorMessage));
if (errorHash == linuxErrorHash || errorHash == macErrorHash) {
return FsErrors.Forbidden(linuxErrorMessage).toBoolResult();
}
return Ok(false);
}
Expand Down

0 comments on commit c02feb1

Please sign in to comment.