diff --git a/frontend/src/app.js b/frontend/src/app.js index f34b85d0bf..d13fd8331c 100644 --- a/frontend/src/app.js +++ b/frontend/src/app.js @@ -75,7 +75,20 @@ class App extends Component { } } + navigateClientUrlToLib = () =>{ + if(window.location.hash && window.location.hash.indexOf('common/lib') != -1){ + let splitUrlArray = window.location.hash.split('/'); + let repoID = splitUrlArray[splitUrlArray.length - 2]; + let url = siteRoot + 'library/' + repoID + '/'; + navigate(url, {repalce: true}); + } + } + componentDidMount() { + // url from client e.g. http://127.0.0.1:8000/#common/lib/34e7fb92-e91d-499d-bcde-c30ea8af9828/ + // navigate to library page http://127.0.0.1:8000/library/34e7fb92-e91d-499d-bcde-c30ea8af9828/ + this.navigateClientUrlToLib(); + // e.g. from http://127.0.0.1:8000/drafts/reviews/ // get reviews // TODO: need refactor later diff --git a/frontend/src/components/cur-dir-path/dir-path.js b/frontend/src/components/cur-dir-path/dir-path.js index d201cbcc5c..ba86066c6d 100644 --- a/frontend/src/components/cur-dir-path/dir-path.js +++ b/frontend/src/components/cur-dir-path/dir-path.js @@ -86,7 +86,7 @@ class DirPath extends React.Component { / )} - {currentPath === '/' ? + {(currentPath === '/' || currentPath === '') ? {repoName}: {repoName} } diff --git a/seahub/urls.py b/seahub/urls.py index 5a9e8b957a..3264e1eb71 100644 --- a/seahub/urls.py +++ b/seahub/urls.py @@ -223,6 +223,7 @@ urlpatterns = [ url(r'^my-libs/$', react_fake_view, name="my_libs"), url(r'^groups/$', react_fake_view, name="groups"), url(r'^group/(?P\d+)/$', react_fake_view, name="group"), + url(r'^library/(?P[-0-9a-f]{36})/$', react_fake_view, name="library_view"), url(r'^library/(?P[-0-9a-f]{36})/(?P[^/]+)/(?P.*)$', react_fake_view, name="lib_view"), url(r'^my-libs/deleted/$', react_fake_view, name="my_libs_deleted"), url(r'^org/$', react_fake_view, name="org"),