mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-13 15:25:13 +00:00
Traverse symlinks when resolving migrations (#2445)
* Traverse symlinks when resolving migrations When enumerating the source directory seeking migration files, `sqlx` ignores entries that aren't files. This was previously reported as #614 and fixed in #985 but apparently regressed somewhere along the way. This commit reintroduces the fix from #985 to the current implementation: use `std::fs::metadata` instead of `std::fs::DirEntry::metadata`. The former is documented to traverse symlinks; the latter does not. * add migrations_symlink test
This commit is contained in:
@@ -24,7 +24,8 @@ impl<'s> MigrationSource<'s> for &'s Path {
|
||||
let mut migrations = Vec::new();
|
||||
|
||||
while let Some(entry) = s.next().await? {
|
||||
if !entry.metadata.is_file() {
|
||||
// std::fs::metadata traverses symlinks
|
||||
if !std::fs::metadata(&entry.path)?.is_file() {
|
||||
// not a file; ignore
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user