Changes 'spo file add' overwrite default. Closes #7100 - #7563
Open
waldekmastykarz wants to merge 1 commit into
Open
Changes 'spo file add' overwrite default. Closes #7100#7563waldekmastykarz wants to merge 1 commit into
waldekmastykarz wants to merge 1 commit into
Conversation
Closes pnp#7100 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new default “do not overwrite” behavior can still overwrite in edge cases because the upload request uses overwrite=true and relies on a pre-check that can be bypassed by races/transient errors.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the SharePoint spo file add command to make --overwrite a boolean flag that defaults to false, aligning the command behavior with the post-#7099 decision captured in #7100.
Changes:
- Converted
--overwritefrom an optional boolean value (--overwrite [overwrite]) to a flag (--overwrite) and removed the deprecation warning about a future default change. - Updated unit tests to reflect the new default behavior (error when a file exists unless
--overwriteis specified). - Updated command documentation to reflect
--overwriteas a flag (no explicittrue/falsevalues or default shown).
File summaries
| File | Description |
|---|---|
| src/m365/spo/commands/file/file-add.ts | Switches --overwrite to a flag and updates the default flow to treat missing --overwrite as “do not overwrite”. |
| src/m365/spo/commands/file/file-add.spec.ts | Updates tests to align with the new default behavior and explicit overwrite usage. |
| docs/docs/cmd/spo/file/file-add.mdx | Updates option docs to represent --overwrite as a flag. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7100
Changes
--overwriteto a flag that defaults to false and updates the command documentation and tests.