Skip to content

Commit a115284

Browse files
committed
fix file path
1 parent fd6c29a commit a115284

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/inspector/storage_agent.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ void StorageAgent::Wire(protocol::UberDispatcher* dispatcher) {
2121
DispatchResponse StorageAgent::getStorageKey(
2222
std::optional<protocol::String> frameId, protocol::String* storageKey) {
2323
auto local_storage_file = env_->options()->localstorage_file;
24-
*storageKey = node::url::FromFilePath(local_storage_file);
24+
*storageKey = node::url::FromFilePath(to_absolute_path(local_storage_file));
2525
return protocol::DispatchResponse::Success();
2626
}
2727

28+
std::string StorageAgent::to_absolute_path(const std::filesystem::path& input) {
29+
std::filesystem::path abs =
30+
std::filesystem::weakly_canonical(std::filesystem::absolute(input));
31+
return abs.generic_string();
32+
}
33+
2834
} // namespace protocol
2935
} // namespace inspector
3036
} // namespace node

src/inspector/storage_agent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class StorageAgent : public protocol::Storage::Backend {
2424
StorageAgent& operator=(const StorageAgent&) = delete;
2525

2626
private:
27+
std::string to_absolute_path(const std::filesystem::path& input);
2728
std::unique_ptr<protocol::Storage::Frontend> frontend_;
2829
Environment* env_;
2930
};

0 commit comments

Comments
 (0)