我在一个仅限Windows的工作环境中工作,开发人员使用各种工具来编辑他们的文件.我们正在使用.gitatlassian堆栈来编写代码版本.我几乎都喜欢它.
我刚刚结束了一场漫长而艰苦的斗争,围绕着如何以及为什么git解释行结尾以及为什么core.autocrlf这样做.我们决定使用core.autocrlf true,一切都很好.
我很想知道如何改变这种行为git status:
CRLF行结尾的文件.我将行结尾更改为 LF
$ git status
On branch somebranch
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Src/the_file_i_changed_to_LF.js
Run Code Online (Sandbox Code Playgroud)但是之后...
$ git commit -a
warning: LF will be replaced by CRLF in Src/the_file_i_changed_to_LF.js.
The file will have its original line endings in your working directory.
On branch …Run Code Online (Sandbox Code Playgroud)在我的angularjs应用程序中,我正在与后端服务器通信,后端服务器需要通过http头进行基本访问身份验证.我已经描述实现对客户端的认证机制在这里.
angular.module('myAuthModule')
.config(['$httpProvider', '$stateProvider',
function ($httpProvider, $stateProvider) {
$httpProvider.interceptors.push('securityInterceptor');
}])
.factory('securityInterceptor', ['$location', '$window', '$q',
function ($location, $window, $q) {
return {
request: function (config) {
config.headers = config.headers || {};
if ($window.sessionStorage.token) {
config.headers['Auth-Key'] = $window.sessionStorage.token;
}
return config;
},
response: function (response) {
if (response.status === 401 || response.status === 403) {
$location.path('/login');
}
return response || $q.when(response);
}
};
}
]);
Run Code Online (Sandbox Code Playgroud)
到目前为止一切顺利,在角度应用程序中处理xhr请求按预期工作.
问题是我需要提供pdf文档的下载链接.我的后端服务器有一个/Document/Pdf/:id资源,用于application/pdf响应ContentDisposition: attachment,还需要进行身份验证.我知道我无法使用xhr启动下载,但是它们都提供了文档下载链接,ngHref并调用了一个功能,例如$window.open('/Document/Pdf/13')导致401 Unauthorized …