如何通过 VSO rest api 从 TFVC 存储库下载 web.config 文件
How to download a web.config file via the VSO rest api from a TFVC repository
visual studio 在线休息 api 有一个休息调用,用于下载 TFVC 存储库中的文件内容。我想下载我所有 TFVC 存储库的最新版本,以便对我们所有的项目进行本地备份。
此 APi 除了一种类型的文件外效果很好:web.config。当我想下载 web.config 文件时,我得到一个 404 状态码。所有其他文件类型(还有 log4net.config 和 web.release.config)都能正确下载,我也在那里得到 202。我有下载文件的正确权限,文件也存在。
我使用 api,如下所述:https://www.visualstudio.com/integrate/api/tfvc/items#Getafile
如您所见,存储库中文件的路径是 URL 的一部分。我认为使用这种语法,Visual Studio 在线默认安全性来自 web.config 等文件。例如IIS 下载 web.config 文件也被禁用。对于我们的 git 存储库,这没有问题,因为 api 不包含 url 中文件的路径,而是作为 url.[=15= 的参数]
有办法解决这个问题吗?未记录的功能?
当我看到此文档时 https://www.visualstudio.com/integrate/api/tfvc/items#Getaspecificversion 它提到:
You can indicate which version to get when you get a file, zip a folder, or get item metadata.
zip 文件夹部分(尚未)记录在案。你们有人知道如何调用 api 的那部分吗?这对我来说也是一种解决方法。
当您使用路径作为查询参数时,这现在是可能的
This format should be used for certain files (like web.config) that are not accessible by using the path as part of the URL due to the default ASP .NET protection. The response is a stream (application/octet-stream) that contains the contents of the file.
http://fabrikam-fiber-inc.visualstudio.com/defaultcollection/_apis/tfvc/items?path=$/fabrikam-fiber-tfvc/website/website/web.config&api-version={version}
以上引自添加后的文档:https://www.visualstudio.com/integrate/api/tfvc/items#Getafile.
visual studio 在线休息 api 有一个休息调用,用于下载 TFVC 存储库中的文件内容。我想下载我所有 TFVC 存储库的最新版本,以便对我们所有的项目进行本地备份。
此 APi 除了一种类型的文件外效果很好:web.config。当我想下载 web.config 文件时,我得到一个 404 状态码。所有其他文件类型(还有 log4net.config 和 web.release.config)都能正确下载,我也在那里得到 202。我有下载文件的正确权限,文件也存在。
我使用 api,如下所述:https://www.visualstudio.com/integrate/api/tfvc/items#Getafile
如您所见,存储库中文件的路径是 URL 的一部分。我认为使用这种语法,Visual Studio 在线默认安全性来自 web.config 等文件。例如IIS 下载 web.config 文件也被禁用。对于我们的 git 存储库,这没有问题,因为 api 不包含 url 中文件的路径,而是作为 url.[=15= 的参数]
有办法解决这个问题吗?未记录的功能?
当我看到此文档时 https://www.visualstudio.com/integrate/api/tfvc/items#Getaspecificversion 它提到:
You can indicate which version to get when you get a file, zip a folder, or get item metadata.
zip 文件夹部分(尚未)记录在案。你们有人知道如何调用 api 的那部分吗?这对我来说也是一种解决方法。
当您使用路径作为查询参数时,这现在是可能的
This format should be used for certain files (like web.config) that are not accessible by using the path as part of the URL due to the default ASP .NET protection. The response is a stream (application/octet-stream) that contains the contents of the file.
http://fabrikam-fiber-inc.visualstudio.com/defaultcollection/_apis/tfvc/items?path=$/fabrikam-fiber-tfvc/website/website/web.config&api-version={version}
以上引自添加后的文档:https://www.visualstudio.com/integrate/api/tfvc/items#Getafile.