Markdown editor not accessible in 7.0.2

Doesn’t work for me either.
Seafile 7.0.2 CE on Ubuntu 16.04.6 behind nginx

For me neither.
Also Seafile 7.0.2 CE, Debian 9, Apache 2.

If after upgrading to 7.0, you are not able to open Markdown file, it is caused by you forgot to migrate file comment when you upgrade to 6.3 version.

You can delete the table base_filecomment and recreate the table.

CREATE TABLE `base_filecomment` (

    `id` int(11) NOT NULL AUTO_INCREMENT,
  `author` varchar(255) NOT NULL,

    `comment` longtext NOT NULL,
  `created_at` datetime NOT NULL,

    `updated_at` datetime NOT NULL,
  `uuid_id` char(32) NOT NULL,

    `detail` longtext NOT NULL,
  `resolved` tinyint(1) NOT NULL,

    PRIMARY KEY (`id`),
  KEY `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` (`uuid_id`),

    KEY `base_filecomment_author_8a4d7e91` (`author`),

    KEY `base_filecomment_resolved_e0717eca` (`resolved`),

    CONSTRAINT `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` FOREIGN KEY (`uuid_id`) REFERENCES `tags_fileuuidmap` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

If you are using SQLite, the statement is

CREATE TABLE "base_filecomment" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
 "author" varchar(255) NOT NULL,
 "comment" text NOT NULL, 
"created_at" datetime NOT NULL, 
"updated_at" datetime NOT NULL, 
"uuid_id" char(32) NOT NULL REFERENCES "tags_fileuuidmap" ("uuid"), 
"detail" text NOT NULL, 
"resolved" bool NOT NULL);
2 Likes

Creating the table didn’t change anything (SQLite).

Can you check what error you have in the seahub.log?

Despite having migrated the comment table in 6.3, I had a similar issue. The missing column was uuid_id according to the log. Executing @daniel.pan’s snippet fixed the issue.

The fix worked for me, thanks a lot!
(using sql)

Here is my seahub.log

2019-06-24 20:06:06,549 [WARNING] django.request:152 get_response Not Found: /seafile/media/assets/frontend/locales/de/translations.json
2019-06-24 20:06:06,871 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /seafile/api2/repos/5a5f4622-e0fa-4137-a629-9d081c745b33/file/detail/
Traceback (most recent call last):
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/seahub/api2/base.py", line 23, in dispatch
    response = super(APIView, self).dispatch(*a, **kw)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.2/seahub/seahub/api2/base.py", line 20, in handle_exception
    return super(APIView, self).handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.2/seahub/seahub/api2/views.py", line 3167, in get
    comment_total = file_comments.count()
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/query.py", line 364, in count
    return self.query.get_count(using=self.db)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/sql/query.py", line 499, in get_count
    number = obj.get_aggregation(using, ['__count'])['__count']
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/sql/query.py", line 480, in get_aggregation
    result = compiler.execute_sql(SINGLE)
  File "/home/seafile/seafile-server-7.0.2/seahub/thirdpart/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
OperationalError: no such column: base_filecomment.uuid_id
2019-06-24 20:06:07,362 [WARNING] django.request:152 get_response Not Found: /seafile/media/assets/frontend/locales/en/translations.json

thank you very much Daniel, it works now perfectly fine!

Anyone have a hint on how to repair my database?

@daniel.pan
I have exactly the same problem as @Tjelfe, can’t open the Markdown editor, similar error message.

seahub.log shows:

2019-07-06 14:11:26,060 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /lib/7d893a95-8ad8-4c52-b88a-d7392ccc8d7f/file/test.md
Traceback (most recent call last):
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/auth/decorators.py", line 27, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/base/decorators.py", line 74, in _decorated
    return func(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/views/file.py", line 680, in view_lib_file
    is_draft = is_draft_file(repo.id, path)
  File "/home/seafile/seafile-server-7.0.3/seahub/seahub/drafts/utils.py", line 42, in is_draft_file
    if draft:
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 258, in __nonzero__
    return type(self).__bool__(self)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 254, in __bool__
    self._fetch_all()
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/seafile/seafile-server-7.0.3/seahub/thirdpart/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
ProgrammingError: (1146, "Table 'seahub-db.drafts_draft' doesn't exist")

Besides all the other warnings, when running upgrade_6.3_7.0.sh the following additional warning was issued:

[WARNING] Failed to execute sql: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL,\n  `updated_at` datetime(6) NOT NULL,\n  `username` varchar(255) NOT' at line 3")

[WARNING] Failed to execute sql: (1005, "Can't create table 'seahub-db.drafts_draftreviewer' (errno: 150)")

How can I create the table seahub-db.drafts_draftreviewer?

It works now, it was again the datetime problem that has occurred before. Probably my SQL version is no longer supported in Debian 8. The solution is as follows:

The column type datetime(6) throws an error, removing (6) helps. To create table drafts_draft:

CREATE TABLE IF NOT EXISTS `drafts_draft` (
  `id` int(11) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `username` varchar(255) NOT NULL,
  `origin_repo_id` varchar(36) NOT NULL,
  `origin_file_version` varchar(100) NOT NULL,
  `draft_file_path` varchar(1024) NOT NULL,
  `origin_file_uuid` char(32) NOT NULL,
  `publish_file_version` varchar(100) DEFAULT NULL,
  `status` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `drafts_draft_origin_file_uuid_id_f150319e_fk_tags_file` (`origin_file_uuid`),
  KEY `drafts_draft_created_at_e9f4523f` (`created_at`),
  KEY `drafts_draft_updated_at_0a144b05` (`updated_at`),
  KEY `drafts_draft_username_73e6738b` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Now it’s possible to create drafts_draftreviewer:

CREATE TABLE IF NOT EXISTS `drafts_draftreviewer` (
  `id` int(11) NOT NULL,
  `reviewer` varchar(255) NOT NULL,
  `draft_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `drafts_draftreviewer_reviewer_e4c777ac` (`reviewer`),
  KEY `drafts_draftreviewer_draft_id_4ea59775_fk_drafts_draft_id` (`draft_id`),
  CONSTRAINT `drafts_draftreviewer_draft_id_4ea59775_fk_drafts_draft_id` FOREIGN KEY (`draft_id`) REFERENCES `drafts_draft` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Thanks @xiez that helped me again :wink: (Seafile server 6.3 is ready for testing! A WYSIWYG Markdown editor and more)

You can find the correct version of mysql tables here: https://github.com/haiwen/seahub/blob/master/sql/mysql.sql

For a particular problematic table, you can delete the old table and create a new one.

2 Likes

It’s finally working - thanks again for Your help.

I am using Seafile with SQLite, how do I perform the given commands for SQLite to fix the markdown editor?
Sorry for asking that noob question. I haven’t dived into databases yet, that’s why I am still using SQLite.
Thanks!

If you are using SQLite, the corresponding SQL is:

CREATE TABLE "base_filecomment" (
  "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  "author" varchar(255) NOT NULL,
  "comment" text NOT NULL,
  "created_at" datetime NOT NULL,
  "updated_at" datetime NOT NULL,
  "uuid_id" char(32) NOT NULL REFERENCES "tags_fileuuidmap" ("uuid"),
  "detail" text NOT NULL,
  "resolved" bool NOT NULL);

You can using a SQLite editor to perform the SQL.

Thanks, that helped a lot!
Now it’s working.

Hi @daniel.pan, I have the same problem with 7.1 and as far as I can tell your solution should also apply to my situation. But since I’m not that knowledgeable about databases I’d very much appreciate an anwer to the following questions:

  1. Are the commands you posted still valid for 7.1 or do I have to modify them?
  2. There are hexadecimal parts in identifiers containing uuid as the string. Are those hexadecimal values in e.g. base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid the same for all seafile deployments or do I have to adapt them somehow?
  3. How did my server end up in this situation? I didn’t migrate comments while upgrading to 6.3 since to my knowledge no file comments were ever used. (99% certain). I didn’t think skipping this apparently unnecessary step could “break” my setup. (The only thing I could imagine is that maybe years ago I once tried adding a comment, deleted it again and forgot about ever trying this feature.)
    Thanks in advance!

Ok, this was easier than expected:

  1. I had a look at the source code referenced by @daniel.pan in another comment and concluded that the relevant table hasn’t been changed in quite some time and so the table definition given for base_filecomment should still be valid.
  2. The hexadecimal parts are part of the original source code, so they should be left unchanged. (I have no idea, though, what their meaning is.)
  3. Still no idea, but before dropping the table I looked around a bit to check that the table doesn’t hold any data. Here’s a shortened summary:
# mysql -u seafile -p          
Enter password:                              
Welcome to the MySQL monitor.  Commands end with ; or \g.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| ccnet-db           |
| seafile-db         |
| seahub-db          |
+--------------------+

mysql> use seahub-db

mysql> show tables;
+-------------------------------------------+
| Tables_in_seahub-db                       |
+-------------------------------------------+
| abuse_reports_abusereport                 |
...
| base_dirfileslastmodifiedinfo             |
| base_filecomment                          |
| base_filecontributors                     |
| base_filediscuss                          |

mysql> select * from base_filecomment;
Empty set (0.01 sec)

mysql> describe base_filecomment
    -> ;
+-------------------------+--------------+------+-----+---------+----------------+
| Field                   | Type         | Null | Key | Default | Extra          |
+-------------------------+--------------+------+-----+---------+----------------+
| id                      | int(11)      | NO   | PRI | NULL    | auto_increment |
| repo_id                 | varchar(36)  | NO   | MUL | NULL    |                |
| parent_path             | longtext     | NO   |     | NULL    |                |
| repo_id_parent_path_md5 | varchar(100) | NO   | MUL | NULL    |                |
| item_name               | longtext     | NO   |     | NULL    |                |
| author                  | varchar(255) | NO   | MUL | NULL    |                |
| comment                 | longtext     | NO   |     | NULL    |                |
| created_at              | datetime     | NO   |     | NULL    |                |
| updated_at              | datetime     | NO   |     | NULL    |                |
| detail                  | longtext     | YES  |     | NULL    |                |
| resolved                | tinyint(1)   | NO   | MUL | 0       |                |
+-------------------------+--------------+------+-----+---------+----------------+

mysql> drop table base_filecomment;
Query OK, 0 rows affected (3.71 sec)

mysql> CREATE TABLE `base_filecomment` (
    ->   `id` int(11) NOT NULL AUTO_INCREMENT,
    ->   `author` varchar(255) NOT NULL,
    ->   `comment` longtext NOT NULL,
    ->   `created_at` datetime NOT NULL,
    ->   `updated_at` datetime NOT NULL,
    ->   `uuid_id` char(32) NOT NULL,
    ->   `detail` longtext NOT NULL,
    ->   `resolved` tinyint(1) NOT NULL,
    ->   PRIMARY KEY (`id`),
    ->   KEY `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` (`uuid_id`),
    ->   KEY `base_filecomment_author_8a4d7e91` (`author`),
    ->   KEY `base_filecomment_resolved_e0717eca` (`resolved`),
    ->   CONSTRAINT `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` FOREIGN KEY (`uuid_id`) REFERENCES `tags_fileuuidmap` (`uuid`)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.88 sec)

mysql> quit;

Now editing markdown files is fine expect for an annoying warning message “Editing files in this browser can lead to slight display problems.” (Firefox 80.0, Linux)

Didn’t work for me. I am using Seafile Server 7.1.5 64bit. I just see a spinner and that is it.

If I open the console I see Blocked loading mixed active content ... and Uncaught (in promise) Error: Network Error ...