Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

fix: return millisecond timestamps from get_file_info() (#12996)

Luke Mino-Altherr2b63add0ad97
diff --git a/app/user_manager.py b/app/user_manager.py
index e18afb71b..0517b3344 100644
--- a/app/user_manager.py
+++ b/app/user_manager.py
@@ -28,8 +28,8 @@ def get_file_info(path: str, relative_to: str) -> FileInfo:
return {
"path": os.path.relpath(path, relative_to).replace(os.sep, '/'),
"size": os.path.getsize(path),
- "modified": os.path.getmtime(path),
- "created": os.path.getctime(path)
+ "modified": int(os.path.getmtime(path) * 1000),
+ "created": int(os.path.getctime(path) * 1000),
}
diff --git a/tests-unit/prompt_server_test/user_manager_test.py b/tests-unit/prompt_server_test/user_manager_test.py
index b939d8e68..27118400f 100644
--- a/tests-unit/prompt_server_test/user_manager_test.py
+++ b/tests-unit/prompt_server_test/user_manager_test.py
@@ -69,7 +69,11 @@ async def test_listuserdata_full_info(aiohttp_client, app, tmp_path):
assert len(result) == 1
assert result[0]["path"] == "file1.txt"
assert "size" in result[0]
- assert "modified" in result[0]
+ assert isinstance(result[0]["modified"], int)
+ assert isinstance(result[0]["created"], int)
+ # Verify millisecond magnitude (timestamps after year 2000 in ms are > 946684800000)
+ assert result[0]["modified"] > 946684800000
+ assert result[0]["created"] > 946684800000
async def test_listuserdata_split_path(aiohttp_client, app, tmp_path):