Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code] encode/decode branchs and tags #34683

Merged
merged 1 commit into from
Apr 8, 2019
Merged

[Code] encode/decode branchs and tags #34683

merged 1 commit into from
Apr 8, 2019

Conversation

mw-ding
Copy link
Contributor

@mw-ding mw-ding commented Apr 8, 2019

Summary

https://github.com/elastic/code/issues/1100

There are 2 places where branches/tags need to be encoded/decoded in case of special characters like /.

  1. Browser URL: The kibana framework will automatically decode the encodeURIComponent hash url. Our app does the routing after this step, so we won't be able to correctly match the revision segment in the hash path. Therefore, we shall use a different encoding for special charactors in the branches/tags. : is a good candidate to replace any illegal charactors in the hash url but legal in the branch/tag name.
  2. REST API: just apply encodeURIComponent on the client side and decodeURIComponent on the server side to any revision param, like all other services do.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@mw-ding mw-ding added the :Code label Apr 8, 2019
@mw-ding mw-ding requested a review from zfy0701 April 8, 2019 03:47
@elasticmachine
Copy link
Contributor

💔 Build Failed

@@ -149,7 +149,7 @@ export function fileRoute(server: hapi.Server, options: ServerOptions) {
const after = queries.after !== undefined;
try {
const repository = await gitOperations.openRepo(uri);
const commit = await gitOperations.getCommit(repository, ref);
const commit = await gitOperations.getCommit(repository, decodeURIComponent(ref));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spacedragon this will raise exception if pass through a branch with /. try this repo: https://github.com/elastic/apm-agent-nodejs/tree/greenkeeper/ws-6.2.1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

both the commented code (borrowed from here) and uncommented code in the screenshot above work.

I think the getCommit(xxx) function needs to be more comprehensive to cover all cases (branch/tag/remote, etc) of revisions. https://stackoverflow.com/a/50192006

let's merge this PR first and use a separate issue to track this.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mw-ding mw-ding merged commit 2888a7c into elastic:feature/merge-code Apr 8, 2019
@mw-ding mw-ding deleted the branch-slash branch April 8, 2019 07:31
zfy0701 added a commit that referenced this pull request Apr 24, 2019
* Create a squash commit for code (#35547)

* [Code] Use system JDK if it is available (#31389)

* [Code] fix functional tests (#31555)

* fix(code/frontend): main page (#29811)

* [Code] fix find references style (#30911)

* [Code]: properly reconnect when langserver is down and clean up logs, fix #839, #891 (#30601)

* fix(code/frontend): wider clickable area for file and structure node (#31176)

* fix(code/frontend): fix project filter press enter location change (#29919)

* Code: move all non-error LSP logging to debug level

* [Code] Dark mode cleanup (#31208)

* fix(code/frontend): fix componentWillMount (#31772)

* [Code] Remove socket.io and use polling message to pull progresses (#31398)

* [Code] Remove socket.io and use polling message to pull progresses

* [Code] refactor the status polling logic

* [Code] fix a minor test issue

* [Code] correctly handle url when workspace is a symbol link. (#31782)

* fix(code/frontend): lose symbols (#31664)

* [Code] functional test for code intelligence (#31673)

* [Code] Add api test for multi code node setup (#31460)

* [Code] fix the bug the first type in querybar is alwasy discarded (#31884)

* [Code] disable cross repo jump functional test

* fix(code/frontend): replace deprecated react lifecycle methods (#31874)

* [Code] Add duration for queued tasks (#31885)

* [Code] fix editor lifecycle method (#31983)

* [Code] force delete repository (#31995)

* feature(code/frontend): implement new breadcrumb design (#31247)

* [Code] handle import error (#31875)

* fix(code/frontend): show import project error message

* [Code] increase the git clone/update throttle param to make ES data update less frequent (#31988)

* fix(code/frontend): side navigation bar width should be fixed (#31876)

* fix(code/frontend): should show import modal (#31987)

* [Code] update repo by set target ref directly (#32002)

* [Code] show nothing if setup status is not ready yet. (#31993)

* [Code] fix editor `goto line` (#32094)

* fix(code/frontend): match props missing (#32100)

* [Code] Improve repository progress polling when clone/index is interrupted by delete (#31989)

* [Code] fix tree flatten/expand/collapse problems (#32099)

* [Code] Fix check for JDK's version (#32104)

* fix(code/frontend): type errors (#32119)

* [Code] specify nodegit commit sha in package.json (#32170)

* [Code] fix setup page (#32179)

* [Code] fix type error in java launcher (#32270)

* [plugin installer] Keep external attributes of files during unarchiving (#32105)

* [plugin installer] Keep external attributes of files during unarchiving

* [plugin installer] add test for files' modes check

* [Code] Ignore certificate check for clone (#32271)

* [Code] fix tsc error

* [Code] fix yarn.lock

* Code: fix getClient is not a function error after merging (#32338)

* [Code] fix load file tree by refresh (#32280)

* [Code] Adjust `GoLauncher` to adapt to the running pattern of go server. (#32293)

This adjust will let the code plugin connect the go-langserver actively.
It should be noted that the `GoLauncher` is a semi-manufacture only
support the detach mode for now.

* [Code] Fix a line number bug for composite content calculation (#32376)

* [Code] function test for securities (#32278)

* [Code] hide import button if current user is not code_admin

* [Code] function test for securities

* [Code] apply the correct timestamp to admin page (#32379)

* [Code]: fix duplicate import agains kbn/test/types package, update typescript language server version (#32439)

* fix(code/frontend): highlight structure node (#32034)

* fix(code/frontend): special symbol container name (#32281)

* Monaco Editor Dark Mode (#32263)

* Initial go at light/dark mode compatability for the Monaco editor.

* Alphebetizing the imports.

* Using the color-convert package to convert rgb to hex values. Updating the monaco hover widget for dark mode.

* Changes to highlight and selection colors.

* Misspelled an EUI color variable name.

* Dark mode for the search results page.

* Prettifying code_result.tsx.

* Removing the monaco scroll decorator from the editor.

* Fixing some type errors for color-convert

* Markdown styling for dark mode.

* Changing the import location of 'chrome' in the monaco editor

* Adding a constant for the getTheme() method and adjusting blame view dark mode styles.

* [Code]: always downgrade language server logging level by one

* [Code]: upgrade ts langserver version, reduce the timeout for waiting langserver init

* [Code] replace _term aggregator order to _key (#32541)

* fix(code/frontend): reset breadcrumbs and fix code href (#32277)

* [Code] improve index progress calculation (#32537)

* [Code]: clean up the way we config LSP related configs (#32607)

* [Code] change nodegit to @elastic/nodegit (#32543)

* [Code] fix tree loading when jumping between different repos (#32650)

* [Code] Use data dir as config dir (#32609)

* [Code]: remove uneccessary color convert after upgrade to EUI 9

* [Code] fix a undefined path problem

* [Code] compute url for language server plugin (#32644)

* [Code] fix typo (#32751)

[Code] fixed some type errors
[Code] try change nodegit_info task to typescript to avoid ci problem

* [Code]: Update UI test snapshot

* [Code]: Disable project setting, branch selection and diff page (#32799)

* [Code] adjust search bar suggestions style (#32726)

* [Code] disable indent guides lines in editors (#32730)

* feature(code/frontend): show loading spinner when loading file/structure tree (#32775)

* fix(code/frontend): truncate blame date (#32764)

* [Code] Call default to lsp options (#32843)

* [Code] fix path handling in windows (#32882)

* feature(code/frontend): implement new 404 page (#32859)

* fix(code/frontend): truncate directory node and fix margin (#32858)

* [Code]: Upgrade ts langserver version

* [Code]: upgrade test snapshot

* [Build]: use the resolution in CreatePackageJsonTask task

* [Code]: correctly handle errors in JDK finding (#32824)

* [Code] Fix functional test (#32991)

* fix(code): clear import project input after submit (#32970)

* [Code] Show some content for file name matching (#32958)

* [Code] fix goto definition failed after user click `go back` (#32968)

* Forcing the filetree open on mobile devices. (#33056)

* [Code] remove requirement for SettingRepository button in tests (#33081)

* [Code]: clean up the code breadcrumb (#33069)

* [Code]: fix top bar button size, width and right margin (#33061)

* [Code]: link to the setup guide button should be the entire button (#33031)

* [Code] Remove the repository status in repo search result item (#32967)

* [Code] Add additional git url validation in clone worker (#33097)

* [Code] hide language server errors (#33082)

* [Code] fix tree expand problems (#32984)

* Fixes for dark mode (#33014)

* Fixing the keyboard shortcut modal appearance in dark mode.

* Fixing the language server icon colors in dark mode.

* Fixing the white background in markdown code blocks in dark mode (Code issue #942)

* Fixing the file tree background color (Code repo issue #986)

* Updating file_tree snapshots.

* Using variables in the shortcuts.scss file, moving the language icon selector to the path rather than the SVG itself.

* Fixing a type error for an unused import.

* [Code] make find references panel's file name clickable (#33083)

* [Code] update worker queue index name to exclude from code user/admin roles (#33223)

* fix(code): symbol tree style (#33224)

* [Code] Index job timeout should show repository index error (#33140)

* [Code] Index job timeout should show repository index error

* [Code] Add a new unit test for clone worker git url validation

* [Code] fix the test

* [Code] adjust repo search scope REST API params (#33219)

* [Code] scroll the selected file into view when navigate files (#33225)

* [Code] fix a minor bug for clone repo

* [Code] fix a tree expand/collapse problem (#33227)

* [Code] fixes for search page (#33281)

* [Code] fixes for search page

* [Code] fix functional test

* [Code] fix functioanl test

* [Code] Calculate the index job timeout based on the size of the repo (#33226)

* [Code]: add a test util file and move common class into it (#33283)

* fix(code/frontend): unset min-width of breadcrumb (#33298)

* fix(code): highlight only one symbol and unexpected tree loading (#33114)

* [Code] use callWithRequest instead of callWithInternalUser in cluster routes (#33098)

* [Code] Add options to disable maven/gradle importer and autobuild (#33240)

* [Code] Add options to disable maven/gradle importer and autobuild

* [Code] rename option to codeSecurity

* [Code] Add initial options to request expander

* [Code]: add option to disable node depdendency downloading (#33340)

* [Code]: change config code.codeSecurity to code.security

* [Code]: more clean up to the test option (#33355)

* [Code] Add git clone url host and protocol whitelist (#33371)

* [Code] align search page border and correct the rendering of empty search page (#33378)

* [Code] focus input when switch search scope with shortcuts (#33379)

* [Code] focus input when switch search scope with shortcuts

* [Code] prevent default action of the shortcut event

* fix(code): add project root link to kibana breadcrumb (#33297)

* Revert "fix(code): add project root link to kibana breadcrumb (#33297)"

This reverts commit e206b71.

* [Code]: upgrade to typescript server 0.1.19

* [Code] Fix randomized port in Java launcher (#33495)

* [Code] fix popover style changes when click on buttons (#33472)

* [Code] fix setup guide style (#33474)

* [Code] fix a problem we start more than one lang-server for the same repo. (#33382)

* fix(code): use monospace font for commit hash (#33307)

* [Code] fix reference panel layout problems (#33546)

* [Code] fix lang-sever initializing popover (#33482)

* fix(code/frontend): truncate commit message (#33548)

* fix(code/frontend): use eui toast for import message (#33487)

* fix(code/frontend): check file path before reveal position (#33555)

* fix(code/frontend): should have no container (#33492)

* [Code] change lsp http error codes (#33633)

* fix(code/frontend): combobox in search setting flyout should be stretched to fit the width (#33553)

* [Code]  Enabgle `go` language of the monaco editor. (#33476)

This change will make the code plugin have the ability in the
development mode to highlight the go source code and send
the go-to definition request to the lang server.

* fix(code/frontend): error message for empty project url (#33549)

* [Code] connect the modify search settings button with the search scope settings (#33691)

* [Code] connect the modify search settings button with the search scope setting

* [Code] a minor fix

* [Code] minor style improvement

* [Code]: fix integration test using new API (#33730)

* [Code] fix a tree expanding problem (#33766)

* Fixing the directory node focus state. (#33821)

* [Code] fix a reference panel height problem (#33767)

* [Code] upgrade nodegit, set max returned commits results (#33913)

* [Code]: Upgrade dependencies

* [Code]: Syntax clean after bable-ts-transform upgrade

* [Code] don't patch native modules when build oss package (#33915)

* [Code] improve repository index naming (#33911)

* Revert "Fixing the directory node focus state. (#33821)"

This reverts commit 866db39.

* [Code] Remove regex git url validation and add more unit tests for repository utils (#33919)

* [Code] more unit tests

* [Code] fix ci breaks

* [Code] handle nodegit deprecation warnings (#33932)

* Reducing top and bottom padding of the directory and file nodes in the directory view. (#34007)

* Styling the File Tree Scrollbar (#33988)

* Styling the scrollbar.

* Removing the duplicated mixin code.

* [Code] check file path in lsp requests (#33916)

* [Code] Implement the index checkpointing (#32682)

* [Code] Persist index checkpoint into index progress in ES

* [Code] apply checkpoint to lsp indexer

* [Code] Add unit tests for index checkpointing

* [Code] move checkpoint from text to object

* [Code]: raise default security level (#33956)

* fix(code/frontend): should not show import error at the first time (#33921)

* [Code]: add missing dependencies that are not in x-pack

* [Code]: fix test snapshot and eui usages

* chore(code/frontend): move props files to __fixtures__ folder (#34031)

* [Code] fix a tree collapse problem (#34030)

* [Code] fix a tree collapse problem
added functional tests for file tree

* Fix type errors and snapshot

* [Code]: simplify the path computation of ts server

* [Code]: clean uneccessary ts-ignores (#34203)

* [Code] apply repo search scope right away in search page (#34029)

* [Code] upgrade git-url-parse version and enable ssh git clone protocol (#34336)

* [Code] upgrade git-url-parse version and enable ssh git clone protocol

* [Code] fix unit test

* [Code]: minor clean up of tslint usage, up ts server version

* fix(code/frontend): use different actions to handle repo scope search and repo search (#34043)

* [Code] fix the crash when we refresh the blame view (#34335)

* [Code] enable ssh protocol, only read ssh key pairs from data folder. (#34412)

* [Code] reset processing jobs when system is initializing (#34408)

* [Code] functional test for git:// url (#34512)

* [Code] fix search query bar item selection issue (#34514)

* [Code]: use absolute path for api path (#34582)

* [Code]: use absolute path for api path

* [Code]: always use url.format to construct url with queries that have variables

* [Code]: prefix lsp api with code

* [Code]: Add chrome.addBasePath call for raw fetch argument

* [Code]: minor UI adjustment (#34659)

* [Code]: fix new eslint errors (#34671)

* [Code] save code_node_info in an index (#34244)

* [Code] fix line height changed after find reference is open (#34682)

* [Code] add description for file and repo typeahead items (#34681)

* [Code] encode/decode branchs and tags (#34683)

* [Code] Incremental Indexing (#33485)

* [Code] Add a git api to get diff from arbitrary 2 revisions

* [Code] Apply incremental index triggering

* [Code] implement the actual incremental indexing

* [Code] apply checkpoint validation for both lsp and lsp incremental indexer

* [Code] add unit tests

* [Code] only disable index scheduler but leave update scheduler on

* [Code]: disable more eslint error due to nodegit

* [Code]: add a go language icon

* [Code]: fix test snapshot after upgrade eui

* fix(code/frontend): make blame view scrollable (#34519)

* [Code]: add beta indicator (#34899)

* [Code]: add a toast for permission change in setup page (#34901)

* [Code] support '/' in getCommit (#34774)

* [Code]: show error message when importing repo at import repo page, fix type error (#34898)

* [Code]: add setup guide link in help menu and pre-define document links (#34902)

* [Code] hide index button when repo is in indexing (#34904)

* [Code]: clean uneccessary code, lint error

* [Code] apply encode to revision in url (#34906)

* [Code] disable blame button when select a non-text file (#34775)

* [Code] disable blame button when select a non-text file

* [Code] Change button label based on file type

* [Code] Provide more reasons for git url validation (#34914)

* fix(code/frontend): should disable structure tab if no structure or load failed (#34908)

* [Code] don't allow access secured routes before x-pack info is available (#34994)

* fix(code/frontend): remove line decorations if no line number specified (#35047)

* Reset initialized when proxy re-connects (#34970)

* [Code] setup multi-code mode by config (#34988)

* [Code] Persist clone error messages (#34977)

* test(code/frontend): history functional test (#34921)

* Implement Code feature control (#35115)

* update security api tests

* rough POC to migrate Code to use Feature Controls

* fix tests

* [Code]: Integrate with Feature control

* Rename callWithRequest to callCluster

* feature(code/frontend): search filter default repo options (#35202)

* [Code] minor fix of proejct status update (#35207)

* feature(code/frontend): search in project page set current repo as default scope (#35062)

* fix(code/frontend): structure tab highlight, align and collapse (#35221)

* [Code] add api integration tests for feature control (#35146)

* [Code] Ignore certificateCheck in update as well (#35273)

* [Code]: fix test snapshot

* [Code] Removing styled components & SCSS cleanup (#35107)

* Removing the sidebar class from the project container and replacing styled component eui buttons with a className.

* Renaming scss includes.

* Moving admin.scss content into _buttons.scss.

* Refactor project_item removing styled components

* Refactor admin.tsx to remove styled components

* Refactor import_project.tsx to remove styled components

* Refactor lang server tab to remove styled components

* Refactor project settings modal removing styled components

* Refactoring setup_guide to remove styled components

* Cleanup sidebar.scss: follow convention for classes

* Refactor codeblock css naming conventions

* Resolving an issue with the monaco scss file name

* Editor file cleanup. Renaming css classes

* Cleaning up the file_tree component.

* Hover widget cleanup.

* Blame cleanup.

* Breadcrumb cleanup.

* Cleaning up clone status — removing ProgressContainer export. Didn't seem to be used anywhere. You can use the codeContainer__progress class to apply those styles now.

* Cleaning up commit history styles

* Putting the indentation back in the file tree.

* Refactoring the main content window.

* Cleaning up the directory component.

* Reducing spacing between directory and file lists.

* Removing styled components from the error panel.

* Reducing the font size of buttons in the source view button groups.

* Removing styled components from main.tsx

* CSS naming & removing styled components from not_found.tsx

* CSS naming & removing styled components from not_found.tsx

* Removing styled components from search_bar and top_bar.

* Removing styled components from query_bar components.

* Removing styled components from search_page components.

* removing styled components from code_symbol_tree

* Fixing a few css issues.

* Updating test snapshots.

* Removing a stray '>' symbol from the search tabs.

* Condensing the spacing of the EUI facets on the search page.

* class name of the flyout container.

* Revert "class name of the flyout container."

This reverts commit 35e9d5c16fd20db5ef15a686eda79bb0fd3f40a6.

* class name tweaks.

* Fixing type errors.

* Putting back an accidental deletion in file_tree.tsx.

* Updating file_tree snapshot.

* Implementing changes from 604e4d1 to address failing tests.

* Adding in additional classes deleted during merge

* Updating test snapshots.

* Removing the focusring from the items in the file_tree. (#35364)

* [Code] pagination for history (#35329)

* Updating the markdown rendering to use EUI styles. (#35439)

* [Code]: fix icon for module and namespace (#35428)

* [Code] apply git clone/update cert check for production env (#35399)

* fix(code/frontend): source view page, click line number should stay in the same side tab (#35396)

* [Code] Add a security flag for git certificate check (#35445)

* fix(code/frontend): fix blank left to blame (#35449)

* [Code]: Improve code setup guide text

* [Code]: fix the capabilities type (#35499)

* [Code]: fix the capabilities type

* [Code] disable the functional test

* [core/ftr] disable tests by commenting out test file

* Updating the font sizes on the directory view. (#35507)

* Updating the font sizes on the directory view.

* Adding less left margin to the recent commits heading.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants