Skip to content

Commit

Permalink
chore: reconcile proxy/processors/pre-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieSlome committed Jan 8, 2024
1 parent 347b656 commit f70d405
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/proxy/processors/pre-processor/parseAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ const exec = async (req) => {
const repoName = getRepoNameFromUrl(req.originalUrl);
const paths = req.originalUrl.split('/');

let type = 'pull';
let type = 'default';

if (paths[paths.length - 1].endsWith('git-upload-pack') && req.method == 'GET') {
type = 'pull';
}
if (
paths[paths.length - 1] == 'git-receive-pack' &&
req.method == 'POST' &&
req.headers['content-type'] == 'application/x-git-receive-pack-request'
) {
type = 'push';
}

return new actions.Action(id, type, req.method, timestamp, repoName);
};

const getRepoNameFromUrl = (url) => {
const parts = url.split('/');

for (let i = 0, len = parts.length; i < len; i++) {
const part = parts[i];
if (part.endsWith('.git')) {
Expand Down

0 comments on commit f70d405

Please sign in to comment.