Skip to content

fix: correctly handle access when moving a file - #873

Merged
mergify[bot] merged 1 commit into
TestableIO:mainfrom
vbreuss:bugfix/870-move-file-with-readonly-attribute
Aug 15, 2022
Merged

fix: correctly handle access when moving a file#873
mergify[bot] merged 1 commit into
TestableIO:mainfrom
vbreuss:bugfix/870-move-file-with-readonly-attribute

Conversation

@vbreuss

Copy link
Copy Markdown
Member

Fixes#870:
Change the order when moving files:

  1. Remove the previous file (throws an exception, if the file access is not sufficient)
  2. Add the moved file on the new location

Also added a unit test to verify the behavior.

@vbreuss
vbreussforce-pushed the bugfix/870-move-file-with-readonly-attribute branch from c757dbb to 3de0256CompareAugust 10, 2022 17:57
Fix function call order also in second `Move` method
@vbreuss
vbreussforce-pushed the bugfix/870-move-file-with-readonly-attribute branch from 3de0256 to a008c15CompareAugust 11, 2022 06:01
Comment threadsrc/System.IO.Abstractions.TestingHelpers/MockFile.cs
@fgreinacherfgreinacher changed the title fix: #870 Moving a readonly file duplicates the filefix: correctly handle access when moving a fileAug 15, 2022
@fgreinacher

Copy link
Copy Markdown
Contributor

Thanks a ton @vbreuss!

@mergify
mergifyBot merged commit df30ba4 into TestableIO:mainAug 15, 2022
@github-actions

Copy link
Copy Markdown

This is addressed in release v17.0.28.

@github-actionsgithub-actionsBot added the state: released Issues that are released label Aug 15, 2022
vbreuss added a commit to vbreuss/System.IO.Abstractions that referenced this pull request Aug 26, 2022
…bleIO#873)
Fix function call order also in second `Move` method
Co-authored-by: Valentin Breuß <v.breuss@tig.at>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: releasedIssues that are released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move a readonly file results in inconsistent state

3 participants

@vbreuss@fgreinacher@vbtig